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