diff options
Diffstat (limited to 'examples/APG/Containers/RB_Tree_Functors.h')
-rw-r--r-- | examples/APG/Containers/RB_Tree_Functors.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/examples/APG/Containers/RB_Tree_Functors.h b/examples/APG/Containers/RB_Tree_Functors.h new file mode 100644 index 00000000000..3eafa89bb30 --- /dev/null +++ b/examples/APG/Containers/RB_Tree_Functors.h @@ -0,0 +1,32 @@ +/* -*- C++ -*- */ +// $Id$ + +#ifndef __RB_TREE_FUNCTORS_H_ +#define __RB_TREE_FUNCTORS_H_ + +#include "ace/Functor.h" + +// Listing 1 code/ch05 +// Same key type. +class KeyType +{ +public: + KeyType () : val_(0) {} + KeyType (int i) : val_ (i) {} + KeyType (const KeyType& kt) { this->val_ = kt.val_; } + operator int() const { return val_; }; + +private: + int val_; +}; + +ACE_TEMPLATE_SPECIALIZATION +class ACE_Less_Than<KeyType> +{ +public: + int operator() (const KeyType k1, const KeyType k2) + { return k1 < k2; } +}; +// Listing 1 + +#endif /* __RB_TREE_FUNCTORS_H_ */ |