New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
sequence_traits.hpp in vendors/XIOS/current/extern/boost/include/boost/algorithm/string – NEMO

source: vendors/XIOS/current/extern/boost/include/boost/algorithm/string/sequence_traits.hpp @ 3428

Last change on this file since 3428 was 3428, checked in by rblod, 12 years ago

importing initial XIOS vendor drop

File size: 6.6 KB
Line 
1//  Boost string_algo library sequence_traits.hpp header file  ---------------------------//
2
3//  Copyright Pavol Droba 2002-2003.
4//
5// Distributed under the Boost Software License, Version 1.0.
6//    (See accompanying file LICENSE_1_0.txt or copy at
7//          http://www.boost.org/LICENSE_1_0.txt)
8
9//  See http://www.boost.org/ for updates, documentation, and revision history.
10
11#ifndef BOOST_STRING_SEQUENCE_TRAITS_HPP
12#define BOOST_STRING_SEQUENCE_TRAITS_HPP
13
14#include <boost/config.hpp>
15#include <boost/mpl/bool.hpp>
16#include <boost/algorithm/string/yes_no_type.hpp>
17
18/*! \file
19    Traits defined in this header are used by various algorithms to achieve
20    better performance for specific containers.
21    Traits provide fail-safe defaults. If a container supports some of these
22    features, it is possible to specialize the specific trait for this container.
23    For lacking compilers, it is possible of define an override for a specific tester
24    function.
25
26    Due to a language restriction, it is not currently possible to define specializations for
27    stl containers without including the corresponding header. To decrease the overhead
28    needed by this inclusion, user can selectively include a specialization
29    header for a specific container. They are located in boost/algorithm/string/stl
30    directory. Alternatively she can include boost/algorithm/string/std_collection_traits.hpp
31    header which contains specializations for all stl containers.
32*/
33
34namespace boost {
35    namespace algorithm {
36
37//  sequence traits  -----------------------------------------------//
38
39#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
40
41        //! Native replace tester
42        /*!
43            Declare an override of this tester function with return
44            type boost::string_algo::yes_type for a sequence with this property.
45
46            \return yes_type if the container has basic_string like native replace
47            method.
48        */
49        no_type has_native_replace_tester(...);
50
51        //! Stable iterators tester
52        /*!
53            Declare an override of this tester function with return
54            type boost::string_algo::yes_type for a sequence with this property.
55
56            \return yes_type if the sequence's insert/replace/erase methods do not invalidate
57            existing iterators.
58        */
59        no_type has_stable_iterators_tester(...);
60
61        //! const time insert tester
62        /*!
63            Declare an override of this tester function with return
64            type boost::string_algo::yes_type for a sequence with this property.
65
66            \return yes_type if the sequence's insert method is working in constant time
67        */
68        no_type has_const_time_insert_tester(...);
69
70        //! const time erase tester
71        /*!
72            Declare an override of this tester function with return
73            type boost::string_algo::yes_type for a sequence with this property.
74
75            \return yes_type if the sequence's erase method is working in constant time
76        */
77        no_type has_const_time_erase_tester(...);
78
79#endif //BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
80
81        //! Native replace trait
82        /*!
83            This trait specifies that the sequence has \c std::string like replace method
84        */
85        template< typename T >
86        class has_native_replace
87        {
88
89#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
90        private:
91            static T* t;
92        public:
93            BOOST_STATIC_CONSTANT(bool, value=(
94                sizeof(has_native_replace_tester(t))==sizeof(yes_type) ) );
95#else  // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
96        public:
97#    if BOOST_WORKAROUND( __IBMCPP__, <= 600 )
98            enum { value = false };
99#    else
100            BOOST_STATIC_CONSTANT(bool, value=false);
101#    endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
102#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
103
104
105            typedef mpl::bool_<has_native_replace<T>::value> type;
106        };
107
108
109        //! Stable iterators trait
110        /*!
111            This trait specifies that the sequence has stable iterators. It means
112            that operations like insert/erase/replace do not invalidate iterators.
113        */
114        template< typename T >
115        class has_stable_iterators
116        {
117#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
118        private:
119            static T* t;
120        public:
121            BOOST_STATIC_CONSTANT(bool, value=(
122                sizeof(has_stable_iterators_tester(t))==sizeof(yes_type) ) );
123#else  // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
124        public:
125#    if BOOST_WORKAROUND( __IBMCPP__, <= 600 )
126            enum { value = false };
127#    else
128            BOOST_STATIC_CONSTANT(bool, value=false);
129#    endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
130#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
131
132            typedef mpl::bool_<has_stable_iterators<T>::value> type;
133        };
134
135
136        //! Const time insert trait
137        /*!
138            This trait specifies that the sequence's insert method has
139            constant time complexity.
140        */
141        template< typename T >
142        class has_const_time_insert
143        {
144#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
145        private:
146            static T* t;
147        public:
148            BOOST_STATIC_CONSTANT(bool, value=(
149                sizeof(has_const_time_insert_tester(t))==sizeof(yes_type) ) );
150#else  // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
151        public:
152#    if BOOST_WORKAROUND( __IBMCPP__, <= 600 )
153            enum { value = false };
154#    else
155            BOOST_STATIC_CONSTANT(bool, value=false);
156#    endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
157#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
158
159            typedef mpl::bool_<has_const_time_insert<T>::value> type;
160        };
161
162
163        //! Const time erase trait
164        /*!
165            This trait specifies that the sequence's erase method has
166            constant time complexity.
167        */
168        template< typename T >
169        class has_const_time_erase
170        {
171#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
172        private:
173            static T* t;
174        public:
175            BOOST_STATIC_CONSTANT(bool, value=(
176                sizeof(has_const_time_erase_tester(t))==sizeof(yes_type) ) );
177#else  // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
178        public:
179#    if BOOST_WORKAROUND( __IBMCPP__, <= 600 )
180            enum { value = false };
181#    else
182            BOOST_STATIC_CONSTANT(bool, value=false);
183#    endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
184#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
185
186            typedef mpl::bool_<has_const_time_erase<T>::value> type;
187        };
188
189    } // namespace algorithm
190} // namespace boost
191
192
193#endif  // BOOST_STRING_SEQUENCE_TRAITS_HPP
Note: See TracBrowser for help on using the repository browser.