[Cppunit-cvs] cppunit2/include/cpptl enumerator.h,1.2,1.3
Brought to you by:
blep
From: Baptiste L. <bl...@us...> - 2004-11-15 08:19:05
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31447/include/cpptl Modified Files: enumerator.h Log Message: * started implementing explicit type passing for returned enumerator in generator function. Index: enumerator.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/enumerator.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** enumerator.h 22 Oct 2004 06:20:23 -0000 1.2 --- enumerator.h 15 Nov 2004 08:18:55 -0000 1.3 *************** *** 304,308 **** } ! const value_type ¤t() const { CPPTL_ENUMERATOR_CHECK_CURRENT; --- 304,308 ---- } ! value_type current() const { CPPTL_ENUMERATOR_CHECK_CURRENT; *************** *** 500,504 **** } - MapKeysEnumerator &operator =( const Super &other ) { --- 500,503 ---- *************** *** 808,816 **** ! template<class ThinEnumeratorType> class SugarEnumerator { public: ! typedef CPPTL_TYPENAME ThinEnumeratorType::value_type value_type; typedef SugarEnumerator<ThinEnumeratorType> self_type; --- 807,816 ---- ! template<class ThinEnumeratorType ! ,class ValueType = CPPTL_TYPENAME ThinEnumeratorType::value_type > class SugarEnumerator { public: ! typedef ValueType value_type; typedef SugarEnumerator<ThinEnumeratorType> self_type; *************** *** 860,863 **** --- 860,871 ---- return EnumType( begin, end ); } + template<class ForwardItType + ,class ValueType> + ForwardItEnumerator<ForwardItType,CPPTL_TYPENAME ValueType::type> + range( ForwardItType begin, ForwardItType end, ValueType ) + { + typedef ForwardItEnumerator<ForwardItType,CPPTL_TYPENAME ValueType::type> EnumType; + return EnumType( begin, end ); + } *************** *** 880,883 **** --- 888,901 ---- } + + template<class ContainerType + ,class ValueType> + ContainerEnumerator<ContainerType,CPPTL_TYPENAME ValueType::type> + container( const ContainerType &enumeratedContainer, ValueType ) + { + typedef ContainerEnumerator<ContainerType,CPPTL_TYPENAME ValueType::type> EnumType; + return EnumType( enumeratedContainer ); + } + template<class ForwardItType> MapKeysEnumerator<ForwardItType> *************** *** 888,891 **** --- 906,918 ---- } + template<class ForwardItType + ,class ValueType> + MapKeysEnumerator<ForwardItType,CPPTL_TYPENAME ValueType::type> + keysRange( ForwardItType begin, ForwardItType end, ValueType ) + { + typedef MapKeysEnumerator<ForwardItType,CPPTL_TYPENAME ValueType::type> EnumType; + return EnumType( begin, end ); + } + template<class ContainerType> MapKeysEnumerator< *************** *** 898,901 **** --- 925,937 ---- } + template<class ContainerType + ,class ValueType> + MapKeysEnumerator< CPPTL_TYPENAME ContainerType::const_iterator + , CPPTL_TYPENAME ValueType::type > + keys( const ContainerType &container, ValueType ) + { + return keysRange( container.begin(), container.end(), ValueType() ); + } + template<class ContainerType> MapValuesEnumerator< *************** *** 909,912 **** --- 945,959 ---- } + template<class ContainerType + ,class ValueType> + MapValuesEnumerator< CPPTL_TYPENAME ContainerType::const_iterator + , CPPTL_TYPENAME ValueType::type > + values( const ContainerType &container, ValueType ) + { + typedef MapValuesEnumerator< ContainerType::const_iterator + , CPPTL_TYPENAME ValueType::type > EnumType; + return EnumType( container.begin(), container.end() ); + } + template<class ForwardItType> MapValuesEnumerator<ForwardItType> *************** *** 917,920 **** --- 964,976 ---- } + template<class ForwardItType + ,class ValueType> + MapValuesEnumerator< ForwardItType, CPPTL_TYPENAME ValueType::type > + valuesRange( ForwardItType begin, ForwardItType end, ValueType ) + { + typedef MapValuesEnumerator< ForwardItType, CPPTL_TYPENAME ValueType::type > EnumType; + return EnumType( begin, end ); + } + template<class EnumeratorType> |