File indexing completed on 2025-01-18 09:38:17
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_ICL_CONCEPT_CONTAINER_HPP_JOFA_100923
0009 #define BOOST_ICL_CONCEPT_CONTAINER_HPP_JOFA_100923
0010
0011 #include <boost/utility/enable_if.hpp>
0012 #include <boost/mpl/and.hpp>
0013 #include <boost/mpl/not.hpp>
0014 #include <boost/icl/type_traits/is_container.hpp>
0015 #include <boost/icl/type_traits/is_icl_container.hpp>
0016
0017 namespace boost{ namespace icl
0018 {
0019
0020
0021
0022
0023
0024
0025
0026 template<class Type>
0027 typename enable_if<is_container<Type>, bool>::type
0028 is_empty(const Type& object)
0029 {
0030 return object.begin()==object.end();
0031 }
0032
0033
0034
0035
0036 template<class Type>
0037 typename enable_if<is_container<Type>, void>::type
0038 clear(Type& object)
0039 {
0040 object.erase(object.begin(), object.end());
0041 }
0042
0043
0044
0045
0046
0047 template<class Type>
0048 typename enable_if<mpl::and_< is_container<Type>
0049 , mpl::not_<is_icl_container<Type> > >
0050 , std::size_t>::type
0051 iterative_size(const Type& object)
0052 {
0053 return object.size();
0054 }
0055
0056
0057
0058
0059
0060 template<class Type>
0061 typename enable_if<is_container<Type>, void>::type
0062 swap(Type& left, Type& right)
0063 {
0064 left.swap(right);
0065 }
0066
0067
0068
0069
0070
0071 template<class Type>
0072 typename enable_if<is_container<Type>, typename Type::iterator>::type
0073 cyclic_prior(Type& object, typename Type::iterator it_)
0074 { return it_ == object.begin() ? object.end() : --it_; }
0075
0076 template<class Type>
0077 typename enable_if<is_container<Type>, typename Type::const_iterator>::type
0078 cyclic_prior(const Type& object, typename Type::const_iterator it_)
0079 { return it_ == object.begin() ? object.end() : --it_; }
0080
0081
0082
0083 }}
0084
0085 #endif
0086
0087