![]() |
|
|||
File indexing completed on 2025-02-22 09:55:55
0001 // Boost string_algo library sequence_traits.hpp header file ---------------------------// 0002 0003 // Copyright Pavol Droba 2002-2003. 0004 // 0005 // Distributed under the Boost Software License, Version 1.0. 0006 // (See accompanying file LICENSE_1_0.txt or copy at 0007 // http://www.boost.org/LICENSE_1_0.txt) 0008 0009 // See http://www.boost.org/ for updates, documentation, and revision history. 0010 0011 #ifndef BOOST_STRING_SEQUENCE_TRAITS_HPP 0012 #define BOOST_STRING_SEQUENCE_TRAITS_HPP 0013 0014 #include <boost/config.hpp> 0015 #include <boost/mpl/bool.hpp> 0016 #include <boost/algorithm/string/yes_no_type.hpp> 0017 0018 /*! \file 0019 Traits defined in this header are used by various algorithms to achieve 0020 better performance for specific containers. 0021 Traits provide fail-safe defaults. If a container supports some of these 0022 features, it is possible to specialize the specific trait for this container. 0023 For lacking compilers, it is possible of define an override for a specific tester 0024 function. 0025 0026 Due to a language restriction, it is not currently possible to define specializations for 0027 stl containers without including the corresponding header. To decrease the overhead 0028 needed by this inclusion, user can selectively include a specialization 0029 header for a specific container. They are located in boost/algorithm/string/stl 0030 directory. Alternatively she can include boost/algorithm/string/std_collection_traits.hpp 0031 header which contains specializations for all stl containers. 0032 */ 0033 0034 namespace boost { 0035 namespace algorithm { 0036 0037 // sequence traits -----------------------------------------------// 0038 0039 0040 //! Native replace trait 0041 /*! 0042 This trait specifies that the sequence has \c std::string like replace method 0043 */ 0044 template< typename T > 0045 class has_native_replace 0046 { 0047 0048 public: 0049 # if BOOST_WORKAROUND( __IBMCPP__, <= 600 ) 0050 enum { value = false }; 0051 # else 0052 BOOST_STATIC_CONSTANT(bool, value=false); 0053 # endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 ) 0054 0055 0056 typedef mpl::bool_<has_native_replace<T>::value> type; 0057 }; 0058 0059 0060 //! Stable iterators trait 0061 /*! 0062 This trait specifies that the sequence has stable iterators. It means 0063 that operations like insert/erase/replace do not invalidate iterators. 0064 */ 0065 template< typename T > 0066 class has_stable_iterators 0067 { 0068 public: 0069 # if BOOST_WORKAROUND( __IBMCPP__, <= 600 ) 0070 enum { value = false }; 0071 # else 0072 BOOST_STATIC_CONSTANT(bool, value=false); 0073 # endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 ) 0074 0075 typedef mpl::bool_<has_stable_iterators<T>::value> type; 0076 }; 0077 0078 0079 //! Const time insert trait 0080 /*! 0081 This trait specifies that the sequence's insert method has 0082 constant time complexity. 0083 */ 0084 template< typename T > 0085 class has_const_time_insert 0086 { 0087 public: 0088 # if BOOST_WORKAROUND( __IBMCPP__, <= 600 ) 0089 enum { value = false }; 0090 # else 0091 BOOST_STATIC_CONSTANT(bool, value=false); 0092 # endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 ) 0093 0094 typedef mpl::bool_<has_const_time_insert<T>::value> type; 0095 }; 0096 0097 0098 //! Const time erase trait 0099 /*! 0100 This trait specifies that the sequence's erase method has 0101 constant time complexity. 0102 */ 0103 template< typename T > 0104 class has_const_time_erase 0105 { 0106 public: 0107 # if BOOST_WORKAROUND( __IBMCPP__, <= 600 ) 0108 enum { value = false }; 0109 # else 0110 BOOST_STATIC_CONSTANT(bool, value=false); 0111 # endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 ) 0112 0113 typedef mpl::bool_<has_const_time_erase<T>::value> type; 0114 }; 0115 0116 } // namespace algorithm 0117 } // namespace boost 0118 0119 0120 #endif // BOOST_STRING_SEQUENCE_TRAITS_HPP
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |