diff --git a/include/boost/algorithm/string/sequence_traits.hpp b/include/boost/algorithm/string/sequence_traits.hpp index 87079a2..9265897 100644 --- a/include/boost/algorithm/string/sequence_traits.hpp +++ b/include/boost/algorithm/string/sequence_traits.hpp @@ -35,6 +35,8 @@ namespace boost { // sequence traits -----------------------------------------------// +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + //! Native replace tester /*! Declare an override of this tester function with return @@ -45,21 +47,6 @@ namespace boost { */ no_type has_native_replace_tester(...); - //! Native replace trait - /*! - This trait specifies that the sequence has \c std::string like replace method - */ - template< typename T > - class has_native_replace - { - private: - static T* t; - public: - BOOST_STATIC_CONSTANT(bool, value=( - sizeof(has_native_replace_tester(t))==sizeof(yes_type) ) ); - typedef mpl::bool_ type; - }; - //! Stable iterators tester /*! Declare an override of this tester function with return @@ -70,23 +57,6 @@ namespace boost { */ no_type has_stable_iterators_tester(...); - //! Stable iterators trait - /*! - This trait specifies that the sequence has stable iterators. It means, - that operations like insert/erase/replace do not invalidate iterators. - */ - template< typename T > - class has_stable_iterators - { - private: - static T* t; - public: - - BOOST_STATIC_CONSTANT(bool, value=( - sizeof(has_stable_iterators_tester(t))==sizeof(yes_type) ) ); - typedef mpl::bool_ type; - }; - //! const time insert tester /*! Declare an override of this tester function with return @@ -96,22 +66,6 @@ namespace boost { */ no_type has_const_time_insert_tester(...); - //! Const time insert trait - /*! - This trait specifies that the sequence's insert method has - constant time complexity. - */ - template< typename T > - class has_const_time_insert - { - private: - static T* t; - public: - BOOST_STATIC_CONSTANT(bool, value=( - sizeof(has_const_time_insert_tester(t))==sizeof(yes_type) ) ); - typedef mpl::bool_ type; - }; - //! const time erase tester /*! Declare an override of this tester function with return @@ -121,6 +75,78 @@ namespace boost { */ no_type has_const_time_erase_tester(...); +#endif //BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + + //! Native replace trait + /*! + This trait specifies that the sequence has \c std::string like replace method + */ + template< typename T > + class has_native_replace + { + +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + private: + static T* t; + public: + BOOST_STATIC_CONSTANT(bool, value=( + sizeof(has_native_replace_tester(t))==sizeof(yes_type) ) ); +#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + public: + BOOST_STATIC_CONSTANT(bool, value=false); +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + + + typedef mpl::bool_ type; + }; + + + //! Stable iterators trait + /*! + This trait specifies that the sequence has stable iterators. It means, + that operations like insert/erase/replace do not invalidate iterators. + */ + template< typename T > + class has_stable_iterators + { +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + private: + static T* t; + public: + BOOST_STATIC_CONSTANT(bool, value=( + sizeof(has_stable_iterators_tester(t))==sizeof(yes_type) ) ); +#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + public: + BOOST_STATIC_CONSTANT(bool, value=false); +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + + typedef mpl::bool_ type; + }; + + + //! Const time insert trait + /*! + This trait specifies that the sequence's insert method has + constant time complexity. + */ + template< typename T > + class has_const_time_insert + { +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + private: + static T* t; + public: + BOOST_STATIC_CONSTANT(bool, value=( + sizeof(has_const_time_insert(t))==sizeof(yes_type) ) ); +#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + public: + BOOST_STATIC_CONSTANT(bool, value=false); +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + + typedef mpl::bool_ type; + }; + + //! Const time erase trait /*! This trait specifies that the sequence's erase method has @@ -129,11 +155,17 @@ namespace boost { template< typename T > class has_const_time_erase { +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION private: static T* t; public: BOOST_STATIC_CONSTANT(bool, value=( - sizeof(has_const_time_erase_tester(t))==sizeof(yes_type) ) ); + sizeof(has_const_time_erase))==sizeof(yes_type) ) ); +#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + public: + BOOST_STATIC_CONSTANT(bool, value=false); +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + typedef mpl::bool_ type; }; diff --git a/include/boost/algorithm/string/std/list_traits.hpp b/include/boost/algorithm/string/std/list_traits.hpp index a36f15e..9838eeb 100644 --- a/include/boost/algorithm/string/std/list_traits.hpp +++ b/include/boost/algorithm/string/std/list_traits.hpp @@ -18,18 +18,52 @@ namespace boost { // std::list<> traits -----------------------------------------------// +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + // stable iterators tester template - yes_type has_stable_iterators_tester( const std::list* ); + yes_type has_stable_iterators_tester( const ::std::list* ) // const time insert tester template - yes_type has_const_time_insert_tester( const std::list* ); + yes_type has_const_time_insert_tester( const ::std::list* ) // const time erase tester template - yes_type has_const_time_erase_tester( const std::list* ); + yes_type has_const_time_erase_tester( const ::std::list* ); + +#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + + // stable iterators trait + template + class has_stable_iterators< ::std::list > + { + public: + BOOST_STATIC_CONSTANT(bool, value=true); + typedef mpl::bool_ type; + }; + + // const time insert trait + template + class has_const_time_insert< ::std::list > + { + public: + BOOST_STATIC_CONSTANT(bool, value=true); + typedef mpl::bool_ type; + }; + + // const time erase trait + template + class has_const_time_erase< ::std::list > + { + public: + BOOST_STATIC_CONSTANT(bool, value=true); + typedef mpl::bool_ type; + }; +#endif + + } // namespace algorithm } // namespace boost diff --git a/include/boost/algorithm/string/std/rope_traits.hpp b/include/boost/algorithm/string/std/rope_traits.hpp index 72c0155..8f0ec7c 100644 --- a/include/boost/algorithm/string/std/rope_traits.hpp +++ b/include/boost/algorithm/string/std/rope_traits.hpp @@ -18,6 +18,8 @@ namespace boost { // SGI's std::rope<> traits -----------------------------------------------// +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + // native replace tester template yes_type has_native_replace_tester( const std::rope* ); @@ -34,6 +36,46 @@ namespace boost { template yes_type has_const_time_erase_tester( const std::rope* ); +#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + + // native replace trait + template + class has_native_replace< std::rope > + { + public: + BOOST_STATIC_CONSTANT(bool, value=true); + typedef mpl::bool_ type; + }; + + // stable iterators trait + template + class has_stable_iterators< std::rope > + { + public: + BOOST_STATIC_CONSTANT(bool, value=true); + typedef mpl::bool_ type; + }; + + // const time insert trait + template + class has_const_time_insert< std::rope > + { + public: + BOOST_STATIC_CONSTANT(bool, value=true); + typedef mpl::bool_ type; + }; + + // const time erase trait + template + class has_const_time_erase< std::rope > + { + public: + BOOST_STATIC_CONSTANT(bool, value=true); + typedef mpl::bool_ type; + }; +#endif + + } // namespace algorithm } // namespace boost diff --git a/include/boost/algorithm/string/std/slist_traits.hpp b/include/boost/algorithm/string/std/slist_traits.hpp index a141aff..43fa91f 100644 --- a/include/boost/algorithm/string/std/slist_traits.hpp +++ b/include/boost/algorithm/string/std/slist_traits.hpp @@ -18,6 +18,8 @@ namespace boost { // SGI's std::slist<> traits -----------------------------------------------// +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + // stable iterators tester template yes_type has_stable_iterators_tester( const std::slist* ); @@ -30,6 +32,37 @@ namespace boost { template yes_type has_const_time_erase_tester( const std::slist* ); +#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + + // stable iterators trait + template + class has_stable_iterators< std::slist > + { + public: + BOOST_STATIC_CONSTANT(bool, value=true); + typedef mpl::bool_ type; + }; + + // const time insert trait + template + class has_const_time_insert< std::slist > + { + public: + BOOST_STATIC_CONSTANT(bool, value=true); + typedef mpl::bool_ type; + }; + + // const time erase trait + template + class has_const_time_erase< std::slist > + { + public: + BOOST_STATIC_CONSTANT(bool, value=true); + typedef mpl::bool_ type; + }; +#endif + + } // namespace algorithm } // namespace boost diff --git a/include/boost/algorithm/string/std/string_traits.hpp b/include/boost/algorithm/string/std/string_traits.hpp index 51cbfb2..4e36b51 100644 --- a/include/boost/algorithm/string/std/string_traits.hpp +++ b/include/boost/algorithm/string/std/string_traits.hpp @@ -18,10 +18,26 @@ namespace boost { // std::basic_string<> traits -----------------------------------------------// +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + // native replace tester template yes_type has_native_replace_tester( const std::basic_string* ); +#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + + // native replace trait + template + class has_native_replace< std::basic_string > + { + public: + BOOST_STATIC_CONSTANT(bool, value=true); + typedef mpl::bool_ type; + }; + + +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + } // namespace algorithm } // namespace boost