メインページ | ネームスペース一覧 | クラス階層 | 構成 | ファイル一覧 | ネームスペースメンバ | 構成メンバ | ファイルメンバ | 関連ページ

compare_methods.h

説明を見る。
00001 #ifndef STATIC_CONTAINER_COMPARE_METHODS_H
00002 
00003 #define STATIC_CONTAINER_COMPARE_METHODS_H
00004 
00005 #include <algorithm>
00006 #include <boost/operators.hpp>
00007 
00008 namespace static_container {
00010     template < typename SubClass >
00011     class compare_methods : public boost::less_than_comparable1< SubClass >, public boost::equality_comparable1< SubClass > {
00012     public:
00013         //  VC 7.1 ではこちらにすると list をうまく取り扱ってくれなかった
00014 /*      friend bool operator == ( const SubClass& a, const SubClass& b ) {
00015             return a.equal( b );
00016         }
00017         
00018         friend bool operator < ( const SubClass& a, const SubClass& b ) {
00019             return std::lexicographical_compare( a.begin(), a.end(), b.begin(), b.end() );
00020         }*/
00021         
00022         bool operator == ( const SubClass& other ) const {
00023             return equal( other );
00024         }
00025         
00026         bool operator < ( const SubClass& other ) const {
00027             return std::lexicographical_compare(
00028                 static_cast< const SubClass* >( this )->begin(), static_cast< const SubClass* >( this )->end(),
00029                 other.begin(), other.end() );
00030         }
00031         
00033         template < typename OtherContainer >
00034         bool equal( const OtherContainer& cont ) const {
00035             if ( static_cast< const SubClass* >( this )->size() == cont.size() ) {
00036                 return std::equal(
00037                     static_cast< const SubClass* >( this )->begin(),
00038                     static_cast< const SubClass* >( this )->end(),
00039                     cont.begin() );
00040             } else {
00041                 return false;
00042             }
00043         }
00044     };
00045 }
00046 
00047 #endif

static_containerに対してSat Jun 19 11:30:58 2004に生成されました。 doxygen 1.3.6