Chris@16: // Boost string_algo library sequence_traits.hpp header file ---------------------------// Chris@16: Chris@16: // Copyright Pavol Droba 2002-2003. Chris@16: // Chris@16: // Distributed under the Boost Software License, Version 1.0. Chris@16: // (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: // See http://www.boost.org/ for updates, documentation, and revision history. Chris@16: Chris@16: #ifndef BOOST_STRING_SEQUENCE_TRAITS_HPP Chris@16: #define BOOST_STRING_SEQUENCE_TRAITS_HPP Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: /*! \file Chris@16: Traits defined in this header are used by various algorithms to achieve Chris@16: better performance for specific containers. Chris@16: Traits provide fail-safe defaults. If a container supports some of these Chris@16: features, it is possible to specialize the specific trait for this container. Chris@16: For lacking compilers, it is possible of define an override for a specific tester Chris@16: function. Chris@16: Chris@16: Due to a language restriction, it is not currently possible to define specializations for Chris@16: stl containers without including the corresponding header. To decrease the overhead Chris@16: needed by this inclusion, user can selectively include a specialization Chris@16: header for a specific container. They are located in boost/algorithm/string/stl Chris@16: directory. Alternatively she can include boost/algorithm/string/std_collection_traits.hpp Chris@16: header which contains specializations for all stl containers. Chris@16: */ Chris@16: Chris@16: namespace boost { Chris@16: namespace algorithm { Chris@16: Chris@16: // sequence traits -----------------------------------------------// Chris@16: Chris@16: Chris@16: //! Native replace trait Chris@16: /*! Chris@16: This trait specifies that the sequence has \c std::string like replace method Chris@16: */ Chris@16: template< typename T > Chris@16: class has_native_replace Chris@16: { Chris@16: Chris@16: public: Chris@16: # if BOOST_WORKAROUND( __IBMCPP__, <= 600 ) Chris@16: enum { value = false }; Chris@16: # else Chris@16: BOOST_STATIC_CONSTANT(bool, value=false); Chris@16: # endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 ) Chris@16: Chris@16: Chris@16: typedef mpl::bool_::value> type; Chris@16: }; Chris@16: Chris@16: Chris@16: //! Stable iterators trait Chris@16: /*! Chris@16: This trait specifies that the sequence has stable iterators. It means Chris@16: that operations like insert/erase/replace do not invalidate iterators. Chris@16: */ Chris@16: template< typename T > Chris@16: class has_stable_iterators Chris@16: { Chris@16: public: Chris@16: # if BOOST_WORKAROUND( __IBMCPP__, <= 600 ) Chris@16: enum { value = false }; Chris@16: # else Chris@16: BOOST_STATIC_CONSTANT(bool, value=false); Chris@16: # endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 ) Chris@16: Chris@16: typedef mpl::bool_::value> type; Chris@16: }; Chris@16: Chris@16: Chris@16: //! Const time insert trait Chris@16: /*! Chris@16: This trait specifies that the sequence's insert method has Chris@16: constant time complexity. Chris@16: */ Chris@16: template< typename T > Chris@16: class has_const_time_insert Chris@16: { Chris@16: public: Chris@16: # if BOOST_WORKAROUND( __IBMCPP__, <= 600 ) Chris@16: enum { value = false }; Chris@16: # else Chris@16: BOOST_STATIC_CONSTANT(bool, value=false); Chris@16: # endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 ) Chris@16: Chris@16: typedef mpl::bool_::value> type; Chris@16: }; Chris@16: Chris@16: Chris@16: //! Const time erase trait Chris@16: /*! Chris@16: This trait specifies that the sequence's erase method has Chris@16: constant time complexity. Chris@16: */ Chris@16: template< typename T > Chris@16: class has_const_time_erase Chris@16: { Chris@16: public: Chris@16: # if BOOST_WORKAROUND( __IBMCPP__, <= 600 ) Chris@16: enum { value = false }; Chris@16: # else Chris@16: BOOST_STATIC_CONSTANT(bool, value=false); Chris@16: # endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 ) Chris@16: Chris@16: typedef mpl::bool_::value> type; Chris@16: }; Chris@16: Chris@16: } // namespace algorithm Chris@16: } // namespace boost Chris@16: Chris@16: Chris@16: #endif // BOOST_STRING_SEQUENCE_TRAITS_HPP