From: <bl...@us...> - 2003-04-28 08:45:44
|
Update of /cvsroot/cpptool/rfta/include/xtl In directory sc8-pr-cvs1:/tmp/cvs-serv16435/include/xtl Modified Files: StlEnumerator.h Log Message: * renamed enumStl to enumStlRange for iterator range access (ambiguous overloard if VC6 work-around is not enabled) * fixed enumMapKeys & enumMapValues * added test for enumMapKeys & enumMapValues Index: StlEnumerator.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/xtl/StlEnumerator.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** StlEnumerator.h 27 Apr 2003 21:59:49 -0000 1.1 --- StlEnumerator.h 28 Apr 2003 08:45:08 -0000 1.2 *************** *** 7,11 **** #include <xtl/Type.h> #include <boost/type_traits.hpp> - #include <functional> namespace Xtl { --- 7,10 ---- *************** *** 56,60 **** Ptr clone() const { ! return Ptr( new ThisType( current_, last_ ) ); } --- 55,59 ---- Ptr clone() const { ! return Ptr( new ThisType( current_, last_, adaptor_ ) ); } *************** *** 80,84 **** ,typename Adaptor> Enumerator<BOOST_DEDUCED_TYPENAME Adaptor::EnumeratedType> ! enumStlAdapt( StlIteratorType first, StlIteratorType last, Adaptor adaptor ) { typedef BOOST_DEDUCED_TYPENAME Adaptor::EnumeratedType EnumeratedType; --- 79,83 ---- ,typename Adaptor> Enumerator<BOOST_DEDUCED_TYPENAME Adaptor::EnumeratedType> ! enumStlRangeAdapt( StlIteratorType first, StlIteratorType last, Adaptor adaptor ) { typedef BOOST_DEDUCED_TYPENAME Adaptor::EnumeratedType EnumeratedType; *************** *** 95,99 **** enumStlAdapt( const StlContainerType &sequence, Adaptor adaptor ) { ! return enumStlAdapt( sequence.begin(), sequence.end(), adaptor ); } --- 94,98 ---- enumStlAdapt( const StlContainerType &sequence, Adaptor adaptor ) { ! return enumStlRangeAdapt( sequence.begin(), sequence.end(), adaptor ); } *************** *** 104,112 **** enumStl( const StlContainerType &sequence, Type<EnumeratedType> ) { ! return Enumerator<EnumeratedType>( ! new StlEnumeratorImpl<BOOST_DEDUCED_TYPENAME StlContainerType::const_iterator ! ,EnumeratedType ! ,ConstructEnumAdaptor<EnumeratedType> >( ! sequence.begin(), sequence.end() ) ); } --- 103,107 ---- enumStl( const StlContainerType &sequence, Type<EnumeratedType> ) { ! return enumStlAdapt( sequence, ConstructEnumAdaptor<EnumeratedType>() ); } *************** *** 124,128 **** ,typename EnumeratedType> Enumerator<EnumeratedType> ! enumStl( StlIteratorType first, StlIteratorType last, Type<EnumeratedType> ) { return Enumerator<EnumeratedType>( --- 119,123 ---- ,typename EnumeratedType> Enumerator<EnumeratedType> ! enumStlRange( StlIteratorType first, StlIteratorType last, Type<EnumeratedType> ) { return Enumerator<EnumeratedType>( *************** *** 142,150 **** ,typename IteratorType> Enumerator<EnumeratedType> ! enumStl( const std::iterator<Category, EnumeratedType, Distance> &first, ! const IteratorType &last ) { ! return enumStlAdapt( static_cast<const IteratorType &>(first), last, ! IdendityEnumAdpator<EnumeratedType>() ); } --- 137,145 ---- ,typename IteratorType> Enumerator<EnumeratedType> ! enumStlRange( const std::iterator<Category, EnumeratedType, Distance> &first, ! const IteratorType &last ) { ! return enumStlRangeAdapt( static_cast<const IteratorType &>(first), last, ! IdendityEnumAdpator<EnumeratedType>() ); } *************** *** 152,158 **** template<typename EnumeratedType> Enumerator<EnumeratedType> ! enumStl( const EnumeratedType *first, const EnumeratedType *last ) { ! return enumStlAdapt( first, last, IdendityEnumAdpator<EnumeratedType>() ); } --- 147,153 ---- template<typename EnumeratedType> Enumerator<EnumeratedType> ! enumStlRange( const EnumeratedType *first, const EnumeratedType *last ) { ! return enumStlRangeAdapt( first, last, IdendityEnumAdpator<EnumeratedType>() ); } *************** *** 161,169 **** template<typename StlIteratorType> Enumerator<BOOST_DEDUCED_TYPENAME std::iterator_traits<StlIteratorType>::value_type> ! enumStl( StlIteratorType first, StlIteratorType last ) { typedef BOOST_DEDUCED_TYPENAME std::iterator_traits<StlIteratorType>::value_type EnumeratedType; ! return enumStlAdapt( first, last, ! IdendityEnumAdpator<EnumeratedType>() ); } --- 156,164 ---- template<typename StlIteratorType> Enumerator<BOOST_DEDUCED_TYPENAME std::iterator_traits<StlIteratorType>::value_type> ! enumStlRange( StlIteratorType first, StlIteratorType last ) { typedef BOOST_DEDUCED_TYPENAME std::iterator_traits<StlIteratorType>::value_type EnumeratedType; ! return enumStlRangeAdapt( first, last, ! IdendityEnumAdpator<EnumeratedType>() ); } *************** *** 199,208 **** template<typename StlIteratorType> ! Enumerator<BOOST_DEDUCED_TYPENAME std::iterator_traits<StlIteratorType>::value_type> ! enumStlMapKeys( StlIteratorType first, StlIteratorType last ) { ! typedef BOOST_DEDUCED_TYPENAME std::iterator_traits<StlIteratorType>::value_type EnumeratedType; ! return enumStlAdapt( first, last, ! FirstEnumAdaptor<EnumeratedType>() ); } --- 194,203 ---- template<typename StlIteratorType> ! Enumerator<BOOST_DEDUCED_TYPENAME std::iterator_traits<StlIteratorType>::value_type::first_type> ! enumStlMapKeysRange( StlIteratorType first, StlIteratorType last ) { ! typedef BOOST_DEDUCED_TYPENAME std::iterator_traits<StlIteratorType>::value_type::first_type EnumeratedType; ! return enumStlRangeAdapt( first, last, ! FirstEnumAdaptor<EnumeratedType>() ); } *************** *** 211,218 **** ,typename Adaptor> Enumerator<BOOST_DEDUCED_TYPENAME Adaptor::EnumeratedType> ! enumStlMapKeys( StlIteratorType first, StlIteratorType last, Adaptor adaptor ) { ! return enumStlAdapt( first, last, ! ComposeAdaptor<Adaptor,FirstEnumAdaptor>() ); } --- 206,214 ---- ,typename Adaptor> Enumerator<BOOST_DEDUCED_TYPENAME Adaptor::EnumeratedType> ! enumStlMapKeysRangeAdapt( StlIteratorType first, StlIteratorType last, Adaptor adaptor ) { ! typedef BOOST_DEDUCED_TYPENAME Adaptor::EnumeratedType EnumeratedType; ! return enumStlRangeAdapt( first, last, ! ComposeAdaptor<Adaptor,FirstEnumAdaptor<EnumeratedType> >() ); } *************** *** 221,227 **** ,typename EnumeratedType> Enumerator<EnumeratedType> ! enumStlMapKeys( StlIteratorType first, StlIteratorType last, Type<EnumeratedType> ) { ! return enumStlMapKeysAdapt( first, last, ConstructEnumAdaptor<EnumeratedType>() ); } --- 217,223 ---- ,typename EnumeratedType> Enumerator<EnumeratedType> ! enumStlMapKeysRange( StlIteratorType first, StlIteratorType last, Type<EnumeratedType> ) { ! return enumStlMapKeysRangeAdapt( first, last, ConstructEnumAdaptor<EnumeratedType>() ); } *************** *** 241,245 **** enumStlMapValuesAdapt( const StlMapType &map, Adaptor adaptor ) { ! typedef BOOST_DEDUCED_TYPENAME StlMapType::referent_type EnumeratedType; return enumStlAdapt( map, ComposeAdaptor<Adaptor,SecondEnumAdaptor>() ); } --- 237,241 ---- enumStlMapValuesAdapt( const StlMapType &map, Adaptor adaptor ) { ! typedef BOOST_DEDUCED_TYPENAME Adaptor::EnumeratedType EnumeratedType; return enumStlAdapt( map, ComposeAdaptor<Adaptor,SecondEnumAdaptor>() ); } *************** *** 247,256 **** template<typename StlIteratorType> ! Enumerator<BOOST_DEDUCED_TYPENAME std::iterator_traits<StlIteratorType>::value_type> ! enumStlMapValues( StlIteratorType first, StlIteratorType last ) { ! typedef BOOST_DEDUCED_TYPENAME std::iterator_traits<StlIteratorType>::value_type EnumeratedType; ! return enumStlAdapt( first, last, ! SecondEnumAdaptor<EnumeratedType>() ); } --- 243,252 ---- template<typename StlIteratorType> ! Enumerator<BOOST_DEDUCED_TYPENAME std::iterator_traits<StlIteratorType>::value_type::second_type> ! enumStlMapValuesRange( StlIteratorType first, StlIteratorType last ) { ! typedef BOOST_DEDUCED_TYPENAME std::iterator_traits<StlIteratorType>::value_type::second_type EnumeratedType; ! return enumStlRangeAdapt( first, last, ! SecondEnumAdaptor<EnumeratedType>() ); } *************** *** 259,266 **** ,typename Adaptor> Enumerator<BOOST_DEDUCED_TYPENAME Adaptor::EnumeratedType> ! enumStlMapValuesAdapt( StlIteratorType first, StlIteratorType last, Adaptor adaptor ) { ! return enumStlAdapt( first, last, ! ComposeAdaptor<Adaptor,SecondEnumAdaptor>() ); } --- 255,264 ---- ,typename Adaptor> Enumerator<BOOST_DEDUCED_TYPENAME Adaptor::EnumeratedType> ! enumStlMapValuesRangeAdapt( StlIteratorType first, StlIteratorType last, Adaptor adaptor ) { ! typedef BOOST_DEDUCED_TYPENAME Adaptor::EnumeratedType EnumeratedType; ! return enumStlRangeAdapt( first, last, ! ComposeAdaptor<Adaptor ! ,SecondEnumAdaptor<EnumeratedType> >() ); } *************** *** 269,275 **** ,typename EnumeratedType> Enumerator<EnumeratedType> ! enumStlMapValues( StlIteratorType first, StlIteratorType last, Type<EnumeratedType> ) { ! return enumStlMapValuesAdapt( first, last, ConstructEnumAdaptor<EnumeratedType>() ); } --- 267,273 ---- ,typename EnumeratedType> Enumerator<EnumeratedType> ! enumStlMapValuesRange( StlIteratorType first, StlIteratorType last, Type<EnumeratedType> ) { ! return enumStlMapValuesRangeAdapt( first, last, ConstructEnumAdaptor<EnumeratedType>() ); } |