update boost on linux
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/*-----------------------------------------------------------------------------+
|
||||
/*-----------------------------------------------------------------------------+
|
||||
Copyright (c) 2010-2010: Joachim Faulhaber
|
||||
+------------------------------------------------------------------------------+
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
@@ -22,25 +22,25 @@ namespace boost{ namespace icl
|
||||
//==============================================================================
|
||||
//= Size
|
||||
//==============================================================================
|
||||
template<class Type>
|
||||
template<class Type>
|
||||
typename enable_if<is_element_container<Type>, std::size_t>::type
|
||||
iterative_size(const Type& object)
|
||||
{
|
||||
return object.size();
|
||||
{
|
||||
return object.size();
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
typename enable_if<is_associative_element_container<Type>, typename Type::size_type>::type
|
||||
size(const Type& object)
|
||||
{
|
||||
return icl::iterative_size(object);
|
||||
{
|
||||
return icl::iterative_size(object);
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
typename enable_if<is_associative_element_container<Type>, typename Type::size_type>::type
|
||||
cardinality(const Type& object)
|
||||
{
|
||||
return icl::iterative_size(object);
|
||||
{
|
||||
return icl::iterative_size(object);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,15 +54,15 @@ cardinality(const Type& object)
|
||||
template<class Type>
|
||||
typename enable_if<is_associative_element_container<Type>, bool>::type
|
||||
within(const typename Type::key_type& key, const Type& super)
|
||||
{
|
||||
return !(super.find(key) == super.end());
|
||||
{
|
||||
return !(super.find(key) == super.end());
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//- bool within(c P&, c T&) T:{s}|{m} P:{s'} fragment_types|key_types
|
||||
//------------------------------------------------------------------------------
|
||||
template<class SubT, class SuperT>
|
||||
typename enable_if<mpl::and_< is_associative_element_container<SuperT>
|
||||
typename enable_if<mpl::and_< is_associative_element_container<SuperT>
|
||||
, is_key_container_of<SubT, SuperT> >,
|
||||
bool>::type
|
||||
within(const SubT& sub, const SuperT& super)
|
||||
@@ -81,7 +81,7 @@ within(const SubT& sub, const SuperT& super)
|
||||
while(sub_ != sub.end())
|
||||
{
|
||||
super_ = super.find(key_value<SubT>(sub_));
|
||||
if(super_ == super.end())
|
||||
if(super_ == super.end())
|
||||
return false;
|
||||
else if(!co_equal(sub_, super_, &sub, &super))
|
||||
return false;
|
||||
@@ -97,8 +97,8 @@ within(const SubT& sub, const SuperT& super)
|
||||
template<class Type>
|
||||
typename enable_if<is_associative_element_container<Type>, bool>::type
|
||||
contains(const Type& super, const typename Type::key_type& key)
|
||||
{
|
||||
return icl::within(key, super);
|
||||
{
|
||||
return icl::within(key, super);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -109,15 +109,15 @@ typename enable_if<mpl::and_< is_associative_element_container<SuperT>
|
||||
, is_key_container_of<SubT, SuperT> >,
|
||||
bool>::type
|
||||
contains(const SuperT& super, const SubT& sub)
|
||||
{
|
||||
return icl::within(sub, super);
|
||||
{
|
||||
return icl::within(sub, super);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
//= Equivalences and Orderings
|
||||
//==============================================================================
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4996) //'std::equal': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'
|
||||
#endif // I do guarantee here that I am using the parameters correctly :)
|
||||
@@ -128,7 +128,7 @@ template<class Type>
|
||||
inline typename enable_if<is_associative_element_container<Type>, bool>::type
|
||||
operator == (const Type& left, const Type& right)
|
||||
{
|
||||
return left.size() == right.size()
|
||||
return left.size() == right.size()
|
||||
&& std::equal(left.begin(), left.end(), right.begin());
|
||||
}
|
||||
|
||||
@@ -148,17 +148,17 @@ inline typename enable_if<is_associative_element_container<Type>, bool>::type
|
||||
operator < (const Type& left, const Type& right)
|
||||
{
|
||||
return std::lexicographical_compare(
|
||||
left.begin(), left.end(), right.begin(), right.end(),
|
||||
left.begin(), left.end(), right.begin(), right.end(),
|
||||
typename Type::element_compare()
|
||||
);
|
||||
}
|
||||
|
||||
template<class LeftT, class RightT>
|
||||
typename enable_if<is_concept_equivalent<is_element_container,LeftT, RightT>,
|
||||
typename enable_if<is_concept_equivalent<is_element_container,LeftT, RightT>,
|
||||
int>::type
|
||||
inclusion_compare(const LeftT& left, const RightT& right)
|
||||
{
|
||||
return Set::subset_compare(left, right,
|
||||
return Set::subset_compare(left, right,
|
||||
left.begin(), left.end(),
|
||||
right.begin(), right.end());
|
||||
}
|
||||
@@ -168,29 +168,29 @@ inclusion_compare(const LeftT& left, const RightT& right)
|
||||
//==============================================================================
|
||||
template <class Type>
|
||||
inline typename enable_if<is_associative_element_container<Type>, Type>::type&
|
||||
operator += (Type& object, const typename Type::value_type& operand)
|
||||
{
|
||||
return icl::add(object, operand);
|
||||
operator += (Type& object, const typename Type::value_type& operand)
|
||||
{
|
||||
return icl::add(object, operand);
|
||||
}
|
||||
|
||||
template <class Type>
|
||||
inline typename enable_if<is_associative_element_container<Type>, Type>::type
|
||||
operator + (Type object, const typename Type::value_type& operand)
|
||||
{
|
||||
return object += operand;
|
||||
operator + (Type object, const typename Type::value_type& operand)
|
||||
{
|
||||
return object += operand;
|
||||
}
|
||||
|
||||
template <class Type>
|
||||
inline typename enable_if<is_associative_element_container<Type>, Type>::type
|
||||
operator + (const typename Type::value_type& operand, Type object)
|
||||
{
|
||||
return object += operand;
|
||||
operator + (const typename Type::value_type& operand, Type object)
|
||||
{
|
||||
return object += operand;
|
||||
}
|
||||
|
||||
template <class Type>
|
||||
inline typename enable_if<is_associative_element_container<Type>, Type>::type&
|
||||
operator += (Type& object, const Type& operand)
|
||||
{
|
||||
operator += (Type& object, const Type& operand)
|
||||
{
|
||||
if(&object == &operand)
|
||||
return object;
|
||||
|
||||
@@ -203,45 +203,45 @@ operator += (Type& object, const Type& operand)
|
||||
|
||||
template <class Type>
|
||||
inline typename enable_if<is_associative_element_container<Type>, Type>::type
|
||||
operator + (Type object, const Type& operand)
|
||||
{
|
||||
return object += operand;
|
||||
operator + (Type object, const Type& operand)
|
||||
{
|
||||
return object += operand;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
template <class Type>
|
||||
inline typename enable_if<is_associative_element_container<Type>, Type>::type&
|
||||
operator |= (Type& object, const typename Type::value_type& operand)
|
||||
{
|
||||
return icl::add(object, operand);
|
||||
operator |= (Type& object, const typename Type::value_type& operand)
|
||||
{
|
||||
return icl::add(object, operand);
|
||||
}
|
||||
|
||||
template <class Type>
|
||||
inline typename enable_if<is_associative_element_container<Type>, Type>::type
|
||||
operator | (Type object, const typename Type::value_type& operand)
|
||||
{
|
||||
return object += operand;
|
||||
operator | (Type object, const typename Type::value_type& operand)
|
||||
{
|
||||
return object += operand;
|
||||
}
|
||||
|
||||
template <class Type>
|
||||
inline typename enable_if<is_associative_element_container<Type>, Type>::type
|
||||
operator | (const typename Type::value_type& operand, Type object)
|
||||
{
|
||||
return object += operand;
|
||||
operator | (const typename Type::value_type& operand, Type object)
|
||||
{
|
||||
return object += operand;
|
||||
}
|
||||
|
||||
template <class Type>
|
||||
inline typename enable_if<is_associative_element_container<Type>, Type>::type&
|
||||
operator |= (Type& object, const Type& operand)
|
||||
{
|
||||
return object += operand;
|
||||
operator |= (Type& object, const Type& operand)
|
||||
{
|
||||
return object += operand;
|
||||
}
|
||||
|
||||
template <class Type>
|
||||
inline typename enable_if<is_associative_element_container<Type>, Type>::type
|
||||
operator | (Type object, const Type& operand)
|
||||
{
|
||||
return object += operand;
|
||||
operator | (Type object, const Type& operand)
|
||||
{
|
||||
return object += operand;
|
||||
}
|
||||
|
||||
|
||||
@@ -252,7 +252,7 @@ operator | (Type object, const Type& operand)
|
||||
//- V insert(T&, c P&) T:{s}|{m} P:{e}|{b} fragment_type
|
||||
//------------------------------------------------------------------------------
|
||||
template<class Type>
|
||||
typename enable_if<is_associative_element_container<Type>,
|
||||
typename enable_if<is_associative_element_container<Type>,
|
||||
std::pair<typename Type::iterator,bool> >::type
|
||||
insert(Type& object, const typename Type::value_type& operand)
|
||||
{
|
||||
@@ -260,9 +260,9 @@ insert(Type& object, const typename Type::value_type& operand)
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
typename enable_if<is_associative_element_container<Type>,
|
||||
typename enable_if<is_associative_element_container<Type>,
|
||||
typename Type::iterator>::type
|
||||
insert(Type& object, typename Type::iterator prior,
|
||||
insert(Type& object, typename Type::iterator prior,
|
||||
const typename Type::value_type& operand)
|
||||
{
|
||||
return object.insert(prior, operand);
|
||||
@@ -278,10 +278,10 @@ insert(Type& object, const Type& addend)
|
||||
typedef typename Type::iterator iterator;
|
||||
|
||||
iterator prior_ = object.end();
|
||||
ICL_const_FORALL(typename Type, elem_, addend)
|
||||
ICL_const_FORALL(typename Type, elem_, addend)
|
||||
icl::insert(object, prior_, *elem_);
|
||||
|
||||
return object;
|
||||
return object;
|
||||
}
|
||||
|
||||
|
||||
@@ -306,10 +306,10 @@ template<class Type>
|
||||
typename enable_if<is_associative_element_container<Type>, Type>::type&
|
||||
erase(Type& object, const Type& erasure)
|
||||
{
|
||||
ICL_const_FORALL(typename Type, elem_, erasure)
|
||||
icl::erase(object, *elem_);
|
||||
ICL_const_FORALL(typename Type, elem_, erasure)
|
||||
icl::erase(object, *elem_);
|
||||
|
||||
return object;
|
||||
return object;
|
||||
}
|
||||
|
||||
|
||||
@@ -319,33 +319,33 @@ erase(Type& object, const Type& erasure)
|
||||
//==============================================================================
|
||||
template <class Type>
|
||||
inline typename enable_if<is_associative_element_container<Type>, Type>::type&
|
||||
operator -= (Type& object, const typename Type::value_type& operand)
|
||||
{
|
||||
return icl::subtract(object, operand);
|
||||
operator -= (Type& object, const typename Type::value_type& operand)
|
||||
{
|
||||
return icl::subtract(object, operand);
|
||||
}
|
||||
|
||||
template <class Type>
|
||||
inline typename enable_if<is_associative_element_container<Type>, Type>::type
|
||||
operator - (Type object, const typename Type::value_type& operand)
|
||||
{
|
||||
return object -= operand;
|
||||
operator - (Type object, const typename Type::value_type& operand)
|
||||
{
|
||||
return object -= operand;
|
||||
}
|
||||
|
||||
template <class Type>
|
||||
inline typename enable_if<is_associative_element_container<Type>, Type>::type&
|
||||
operator -= (Type& object, const Type& subtrahend)
|
||||
{
|
||||
operator -= (Type& object, const Type& subtrahend)
|
||||
{
|
||||
ICL_const_FORALL(typename Type, it_, subtrahend)
|
||||
icl::subtract(object, *it_);
|
||||
|
||||
return object;
|
||||
return object;
|
||||
}
|
||||
|
||||
template <class Type>
|
||||
inline typename enable_if<is_associative_element_container<Type>, Type>::type
|
||||
operator - (Type object, const Type& subtrahend)
|
||||
{
|
||||
return object -= subtrahend;
|
||||
operator - (Type object, const Type& subtrahend)
|
||||
{
|
||||
return object -= subtrahend;
|
||||
}
|
||||
|
||||
|
||||
@@ -353,25 +353,25 @@ operator - (Type object, const Type& subtrahend)
|
||||
//= Intersection
|
||||
//==============================================================================
|
||||
//------------------------------------------------------------------------------
|
||||
//- void add_intersection(T&, c T&, c P&) T:{s}{m} P:{e}{e} key_type
|
||||
//- void add_intersection(T&, c T&, c P&) T:{s}{m} P:{e}{e} key_type
|
||||
//------------------------------------------------------------------------------
|
||||
template<class Type>
|
||||
inline typename enable_if<is_associative_element_container<Type>, void>::type
|
||||
add_intersection(Type& section, const Type& object,
|
||||
add_intersection(Type& section, const Type& object,
|
||||
const typename Type::key_type& operand)
|
||||
{
|
||||
typedef typename Type::const_iterator const_iterator;
|
||||
const_iterator it_ = object.find(operand);
|
||||
if(it_ != object.end())
|
||||
if(it_ != object.end())
|
||||
icl::add(section, *it_);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//- void add_intersection(T&, c T&, c P&) T:{s}{m} P:{s}{s} set key_type
|
||||
//- void add_intersection(T&, c T&, c P&) T:{s}{m} P:{s}{s} set key_type
|
||||
//------------------------------------------------------------------------------
|
||||
template<class Type>
|
||||
inline typename enable_if<is_associative_element_container<Type>, void>::type
|
||||
add_intersection(Type& section, const Type& object,
|
||||
add_intersection(Type& section, const Type& object,
|
||||
const typename key_container_type_of<Type>::type& operand)
|
||||
{
|
||||
typedef typename key_container_type_of<Type>::type key_container_type;
|
||||
@@ -386,12 +386,12 @@ add_intersection(Type& section, const Type& object,
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//- Intersection<ElementMap|ElementSet>
|
||||
//- Intersection<ElementMap|ElementSet>
|
||||
//------------------------------------------------------------------------------
|
||||
template<class Type>
|
||||
inline typename enable_if<is_associative_element_container<Type>, Type>::type&
|
||||
operator &= (Type& object, const typename Type::key_type& operand)
|
||||
{
|
||||
{
|
||||
Type section;
|
||||
add_intersection(section, object, operand);
|
||||
object.swap(section);
|
||||
@@ -415,7 +415,7 @@ operator & (const typename Type::key_type& operand, Type object)
|
||||
template<class Type>
|
||||
inline typename enable_if<is_associative_element_container<Type>, Type>::type&
|
||||
operator &= (Type& object, const typename key_container_type_of<Type>::type& operand)
|
||||
{
|
||||
{
|
||||
Type section;
|
||||
add_intersection(section, object, operand);
|
||||
object.swap(section);
|
||||
@@ -458,7 +458,7 @@ template<class Type>
|
||||
inline typename enable_if<is_associative_element_container<Type>, Type>::type
|
||||
operator ^ (Type object, const Type& operand)
|
||||
{
|
||||
return object ^= operand;
|
||||
return object ^= operand;
|
||||
}
|
||||
|
||||
|
||||
@@ -472,7 +472,7 @@ erase_if(const Predicate& pred, Type& object)
|
||||
typename Type::iterator it_ = object.begin();
|
||||
while(it_ != object.end())
|
||||
if(pred(*it_))
|
||||
icl::erase(object, it_++);
|
||||
icl::erase(object, it_++);
|
||||
else ++it_;
|
||||
return object;
|
||||
}
|
||||
@@ -483,9 +483,9 @@ add_if(const Predicate& pred, Type& object, const Type& src)
|
||||
{
|
||||
typename Type::const_iterator it_ = src.begin();
|
||||
while(it_ != src.end())
|
||||
if(pred(*it_))
|
||||
icl::add(object, *it_++);
|
||||
|
||||
if(pred(*it_))
|
||||
icl::add(object, *it_++);
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
@@ -502,5 +502,3 @@ assign_if(const Predicate& pred, Type& object, const Type& src)
|
||||
}} // namespace boost icl
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ Copyright (c) 2010-2010: Joachim Faulhaber
|
||||
#ifndef BOOST_ICL_CONCEPT_INTERVAL_HPP_JOFA_100323
|
||||
#define BOOST_ICL_CONCEPT_INTERVAL_HPP_JOFA_100323
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
@@ -38,7 +38,7 @@ namespace boost{namespace icl
|
||||
//==============================================================================
|
||||
template<class Type>
|
||||
inline typename enable_if<is_interval<Type>, bool>::type
|
||||
domain_less(const typename interval_traits<Type>::domain_type& left,
|
||||
domain_less(const typename interval_traits<Type>::domain_type& left,
|
||||
const typename interval_traits<Type>::domain_type& right)
|
||||
{
|
||||
return typename interval_traits<Type>::domain_compare()(left, right);
|
||||
@@ -46,7 +46,7 @@ domain_less(const typename interval_traits<Type>::domain_type& left,
|
||||
|
||||
template<class Type>
|
||||
inline typename enable_if<is_interval<Type>, bool>::type
|
||||
domain_less_equal(const typename interval_traits<Type>::domain_type& left,
|
||||
domain_less_equal(const typename interval_traits<Type>::domain_type& left,
|
||||
const typename interval_traits<Type>::domain_type& right)
|
||||
{
|
||||
return !(typename interval_traits<Type>::domain_compare()(right, left));
|
||||
@@ -54,7 +54,7 @@ domain_less_equal(const typename interval_traits<Type>::domain_type& left,
|
||||
|
||||
template<class Type>
|
||||
inline typename enable_if<is_interval<Type>, bool>::type
|
||||
domain_equal(const typename interval_traits<Type>::domain_type& left,
|
||||
domain_equal(const typename interval_traits<Type>::domain_type& left,
|
||||
const typename interval_traits<Type>::domain_type& right)
|
||||
{
|
||||
typedef typename interval_traits<Type>::domain_compare domain_compare;
|
||||
@@ -64,7 +64,7 @@ domain_equal(const typename interval_traits<Type>::domain_type& left,
|
||||
template<class Type>
|
||||
inline typename enable_if< is_interval<Type>
|
||||
, typename interval_traits<Type>::domain_type>::type
|
||||
domain_next(const typename interval_traits<Type>::domain_type value)
|
||||
domain_next(const typename interval_traits<Type>::domain_type value)
|
||||
{
|
||||
typedef typename interval_traits<Type>::domain_type domain_type;
|
||||
typedef typename interval_traits<Type>::domain_compare domain_compare;
|
||||
@@ -74,7 +74,7 @@ domain_next(const typename interval_traits<Type>::domain_type value)
|
||||
template<class Type>
|
||||
inline typename enable_if< is_interval<Type>
|
||||
, typename interval_traits<Type>::domain_type>::type
|
||||
domain_prior(const typename interval_traits<Type>::domain_type value)
|
||||
domain_prior(const typename interval_traits<Type>::domain_type value)
|
||||
{
|
||||
typedef typename interval_traits<Type>::domain_type domain_type;
|
||||
typedef typename interval_traits<Type>::domain_compare domain_compare;
|
||||
@@ -110,7 +110,7 @@ singleton(const typename interval_traits<Type>::domain_type& value)
|
||||
typedef typename interval_traits<Type>::domain_type domain_type;
|
||||
typedef typename interval_traits<Type>::domain_compare domain_compare;
|
||||
BOOST_ASSERT((numeric_minimum<domain_type, domain_compare, is_numeric<domain_type>::value>
|
||||
::is_less_than(value) ));
|
||||
::is_less_than(value) ));
|
||||
|
||||
return interval_traits<Type>::construct(domain_prior<Type>(value), value);
|
||||
}
|
||||
@@ -123,7 +123,7 @@ singleton(const typename interval_traits<Type>::domain_type& value)
|
||||
typedef typename interval_traits<Type>::domain_type domain_type;
|
||||
typedef typename interval_traits<Type>::domain_compare domain_compare;
|
||||
BOOST_ASSERT((numeric_minimum<domain_type, domain_compare, is_numeric<domain_type>::value>
|
||||
::is_less_than(value)));
|
||||
::is_less_than(value)));
|
||||
|
||||
return interval_traits<Type>::construct( domain_prior<Type>(value)
|
||||
, domain_next<Type>(value));
|
||||
@@ -149,10 +149,10 @@ namespace detail
|
||||
|
||||
//==============================================================================
|
||||
//= Construct<Interval> unit_trail == generalized singleton
|
||||
// The smallest interval on an incrementable (and decrementable) type that can
|
||||
// The smallest interval on an incrementable (and decrementable) type that can
|
||||
// be constructed using ++ and -- and such that it contains a given value.
|
||||
// If 'Type' is discrete, 'unit_trail' and 'singleton' are identical. So we
|
||||
// can view 'unit_trail' as a generalized singleton for static intervals of
|
||||
// If 'Type' is discrete, 'unit_trail' and 'singleton' are identical. So we
|
||||
// can view 'unit_trail' as a generalized singleton for static intervals of
|
||||
// continuous types.
|
||||
//==============================================================================
|
||||
template<class Type>
|
||||
@@ -179,7 +179,7 @@ unit_trail(const typename interval_traits<Type>::domain_type& value)
|
||||
typedef typename interval_traits<Type>::domain_type domain_type;
|
||||
typedef typename interval_traits<Type>::domain_compare domain_compare;
|
||||
BOOST_ASSERT((numeric_minimum<domain_type, domain_compare, is_numeric<domain_type>::value>
|
||||
::is_less_than(value) ));
|
||||
::is_less_than(value) ));
|
||||
|
||||
return interval_traits<Type>::construct(domain_prior<Type>(value), value);
|
||||
}
|
||||
@@ -196,7 +196,7 @@ unit_trail(const typename interval_traits<Type>::domain_type& value)
|
||||
typedef typename interval_traits<Type>::domain_type domain_type;
|
||||
typedef typename interval_traits<Type>::domain_compare domain_compare;
|
||||
BOOST_ASSERT((numeric_minimum<domain_type, domain_compare, is_numeric<domain_type>::value>
|
||||
::is_less_than(value)));
|
||||
::is_less_than(value)));
|
||||
|
||||
return interval_traits<Type>::construct( domain_prior<Type>(value)
|
||||
, domain_next<Type>(value));
|
||||
@@ -263,7 +263,8 @@ typename enable_if<is_interval<Type>, Type>::type
|
||||
span(const typename interval_traits<Type>::domain_type& left,
|
||||
const typename interval_traits<Type>::domain_type& right)
|
||||
{
|
||||
if(interval_traits<Type>::domain_compare()(left,right))
|
||||
typedef typename interval_traits<Type>::domain_compare domain_compare;
|
||||
if(domain_compare()(left,right))
|
||||
return construct<Type>(left, right);
|
||||
else
|
||||
return construct<Type>(right, left);
|
||||
@@ -276,7 +277,8 @@ typename enable_if<is_static_right_open<Type>, Type>::type
|
||||
hull(const typename interval_traits<Type>::domain_type& left,
|
||||
const typename interval_traits<Type>::domain_type& right)
|
||||
{
|
||||
if(interval_traits<Type>::domain_compare()(left,right))
|
||||
typedef typename interval_traits<Type>::domain_compare domain_compare;
|
||||
if(domain_compare()(left,right))
|
||||
return construct<Type>(left, domain_next<Type>(right));
|
||||
else
|
||||
return construct<Type>(right, domain_next<Type>(left));
|
||||
@@ -289,16 +291,16 @@ hull(const typename interval_traits<Type>::domain_type& left,
|
||||
{
|
||||
typedef typename interval_traits<Type>::domain_type domain_type;
|
||||
typedef typename interval_traits<Type>::domain_compare domain_compare;
|
||||
if(interval_traits<Type>::domain_compare()(left,right))
|
||||
if(domain_compare()(left,right))
|
||||
{
|
||||
BOOST_ASSERT((numeric_minimum<domain_type, domain_compare, is_numeric<domain_type>::value>
|
||||
::is_less_than(left) ));
|
||||
::is_less_than(left) ));
|
||||
return construct<Type>(domain_prior<Type>(left), right);
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_ASSERT((numeric_minimum<domain_type, domain_compare, is_numeric<domain_type>::value>
|
||||
::is_less_than(right) ));
|
||||
::is_less_than(right) ));
|
||||
return construct<Type>(domain_prior<Type>(right), left);
|
||||
}
|
||||
}
|
||||
@@ -308,7 +310,8 @@ typename enable_if<is_static_closed<Type>, Type>::type
|
||||
hull(const typename interval_traits<Type>::domain_type& left,
|
||||
const typename interval_traits<Type>::domain_type& right)
|
||||
{
|
||||
if(interval_traits<Type>::domain_compare()(left,right))
|
||||
typedef typename interval_traits<Type>::domain_compare domain_compare;
|
||||
if(domain_compare()(left,right))
|
||||
return construct<Type>(left, right);
|
||||
else
|
||||
return construct<Type>(right, left);
|
||||
@@ -321,17 +324,17 @@ hull(const typename interval_traits<Type>::domain_type& left,
|
||||
{
|
||||
typedef typename interval_traits<Type>::domain_type domain_type;
|
||||
typedef typename interval_traits<Type>::domain_compare domain_compare;
|
||||
if(interval_traits<Type>::domain_compare()(left,right))
|
||||
if(domain_compare()(left,right))
|
||||
{
|
||||
BOOST_ASSERT((numeric_minimum<domain_type, domain_compare, is_numeric<domain_type>::value>
|
||||
::is_less_than(left) ));
|
||||
::is_less_than(left) ));
|
||||
return construct<Type>( domain_prior<Type>(left)
|
||||
, domain_next<Type>(right));
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_ASSERT((numeric_minimum<domain_type, domain_compare, is_numeric<domain_type>::value>
|
||||
::is_less_than(right) ));
|
||||
::is_less_than(right) ));
|
||||
return construct<Type>( domain_prior<Type>(right)
|
||||
, domain_next<Type>(left));
|
||||
}
|
||||
@@ -342,7 +345,8 @@ typename enable_if<has_dynamic_bounds<Type>, Type>::type
|
||||
hull(const typename interval_traits<Type>::domain_type& left,
|
||||
const typename interval_traits<Type>::domain_type& right)
|
||||
{
|
||||
if(interval_traits<Type>::domain_compare()(left,right))
|
||||
typedef typename interval_traits<Type>::domain_compare domain_compare;
|
||||
if(domain_compare()(left,right))
|
||||
return construct<Type>(left, right, interval_bounds::closed());
|
||||
else
|
||||
return construct<Type>(right, left, interval_bounds::closed());
|
||||
@@ -353,160 +357,160 @@ hull(const typename interval_traits<Type>::domain_type& left,
|
||||
//==============================================================================
|
||||
|
||||
template<class Type>
|
||||
inline typename enable_if<is_interval<Type>,
|
||||
inline typename enable_if<is_interval<Type>,
|
||||
typename interval_traits<Type>::domain_type>::type
|
||||
lower(const Type& object)
|
||||
{
|
||||
{
|
||||
return interval_traits<Type>::lower(object);
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
inline typename enable_if<is_interval<Type>,
|
||||
inline typename enable_if<is_interval<Type>,
|
||||
typename interval_traits<Type>::domain_type>::type
|
||||
upper(const Type& object)
|
||||
{
|
||||
{
|
||||
return interval_traits<Type>::upper(object);
|
||||
}
|
||||
|
||||
|
||||
//- first ----------------------------------------------------------------------
|
||||
template<class Type>
|
||||
inline typename
|
||||
inline typename
|
||||
enable_if< mpl::or_<is_static_right_open<Type>, is_static_closed<Type> >
|
||||
, typename interval_traits<Type>::domain_type>::type
|
||||
first(const Type& object)
|
||||
{
|
||||
{
|
||||
return lower(object);
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
inline typename
|
||||
inline typename
|
||||
enable_if< mpl::and_< mpl::or_<is_static_left_open<Type>, is_static_open<Type> >
|
||||
, is_discrete<typename interval_traits<Type>::domain_type> >
|
||||
, typename interval_traits<Type>::domain_type>::type
|
||||
first(const Type& object)
|
||||
{
|
||||
{
|
||||
return domain_next<Type>(lower(object));
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
inline typename enable_if<is_discrete_interval<Type>,
|
||||
inline typename enable_if<is_discrete_interval<Type>,
|
||||
typename interval_traits<Type>::domain_type>::type
|
||||
first(const Type& object)
|
||||
{
|
||||
return is_left_closed(object.bounds()) ?
|
||||
lower(object) :
|
||||
{
|
||||
return is_left_closed(object.bounds()) ?
|
||||
lower(object) :
|
||||
domain_next<Type>(lower(object));
|
||||
}
|
||||
|
||||
//- last -----------------------------------------------------------------------
|
||||
template<class Type>
|
||||
inline typename
|
||||
inline typename
|
||||
enable_if< mpl::or_<is_static_left_open<Type>, is_static_closed<Type> >
|
||||
, typename interval_traits<Type>::domain_type>::type
|
||||
last(const Type& object)
|
||||
{
|
||||
{
|
||||
return upper(object);
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
inline typename
|
||||
inline typename
|
||||
enable_if< mpl::and_< mpl::or_<is_static_right_open<Type>, is_static_open<Type> >
|
||||
, is_discrete<typename interval_traits<Type>::domain_type> >
|
||||
, typename interval_traits<Type>::domain_type>::type
|
||||
last(const Type& object)
|
||||
{
|
||||
{
|
||||
typedef typename interval_traits<Type>::domain_type domain_type;
|
||||
typedef typename interval_traits<Type>::domain_compare domain_compare;
|
||||
BOOST_ASSERT((numeric_minimum<domain_type, domain_compare, is_numeric<domain_type>::value>
|
||||
::is_less_than(upper(object)) ));
|
||||
::is_less_than(upper(object)) ));
|
||||
return domain_prior<Type>(upper(object));
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
inline typename enable_if<is_discrete_interval<Type>,
|
||||
inline typename enable_if<is_discrete_interval<Type>,
|
||||
typename interval_traits<Type>::domain_type>::type
|
||||
last(const Type& object)
|
||||
{
|
||||
{
|
||||
typedef typename interval_traits<Type>::domain_type domain_type;
|
||||
typedef typename interval_traits<Type>::domain_compare domain_compare;
|
||||
BOOST_ASSERT((numeric_minimum<domain_type, domain_compare, is_numeric<domain_type>::value>
|
||||
::is_less_than_or(upper(object), is_right_closed(object.bounds())) ));
|
||||
return is_right_closed(object.bounds()) ?
|
||||
upper(object) :
|
||||
::is_less_than_or(upper(object), is_right_closed(object.bounds())) ));
|
||||
return is_right_closed(object.bounds()) ?
|
||||
upper(object) :
|
||||
domain_prior<Type>(upper(object));
|
||||
}
|
||||
|
||||
//- last_next ------------------------------------------------------------------
|
||||
template<class Type>
|
||||
inline typename
|
||||
inline typename
|
||||
enable_if< mpl::and_< mpl::or_<is_static_left_open<Type>, is_static_closed<Type> >
|
||||
, is_discrete<typename interval_traits<Type>::domain_type> >
|
||||
, typename interval_traits<Type>::domain_type>::type
|
||||
last_next(const Type& object)
|
||||
{
|
||||
{
|
||||
return domain_next<Type>(upper(object));
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
inline typename
|
||||
inline typename
|
||||
enable_if< mpl::and_< mpl::or_<is_static_right_open<Type>, is_static_open<Type> >
|
||||
, is_discrete<typename interval_traits<Type>::domain_type> >
|
||||
, typename interval_traits<Type>::domain_type>::type
|
||||
last_next(const Type& object)
|
||||
{
|
||||
{
|
||||
//CL typedef typename interval_traits<Type>::domain_type domain_type;
|
||||
return upper(object); // NOTE: last_next is implemented to avoid calling pred(object)
|
||||
} // For unsigned integral types this may cause underflow.
|
||||
|
||||
template<class Type>
|
||||
inline typename enable_if<is_discrete_interval<Type>,
|
||||
inline typename enable_if<is_discrete_interval<Type>,
|
||||
typename interval_traits<Type>::domain_type>::type
|
||||
last_next(const Type& object)
|
||||
{
|
||||
return is_right_closed(object.bounds()) ?
|
||||
domain_next<Type>(upper(object)):
|
||||
{
|
||||
return is_right_closed(object.bounds()) ?
|
||||
domain_next<Type>(upper(object)):
|
||||
upper(object) ;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template<class Type>
|
||||
typename enable_if<has_dynamic_bounds<Type>,
|
||||
typename enable_if<has_dynamic_bounds<Type>,
|
||||
typename Type::bounded_domain_type>::type
|
||||
bounded_lower(const Type& object)
|
||||
{
|
||||
return typename
|
||||
Type::bounded_domain_type(lower(object), object.bounds().left());
|
||||
{
|
||||
return typename
|
||||
Type::bounded_domain_type(lower(object), object.bounds().left());
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
typename enable_if<has_dynamic_bounds<Type>,
|
||||
typename enable_if<has_dynamic_bounds<Type>,
|
||||
typename Type::bounded_domain_type>::type
|
||||
reverse_bounded_lower(const Type& object)
|
||||
{
|
||||
return typename
|
||||
Type::bounded_domain_type(lower(object),
|
||||
object.bounds().reverse_left());
|
||||
{
|
||||
return typename
|
||||
Type::bounded_domain_type(lower(object),
|
||||
object.bounds().reverse_left());
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
typename enable_if<has_dynamic_bounds<Type>,
|
||||
typename enable_if<has_dynamic_bounds<Type>,
|
||||
typename Type::bounded_domain_type>::type
|
||||
bounded_upper(const Type& object)
|
||||
{
|
||||
return typename
|
||||
Type::bounded_domain_type(upper(object),
|
||||
object.bounds().right());
|
||||
{
|
||||
return typename
|
||||
Type::bounded_domain_type(upper(object),
|
||||
object.bounds().right());
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
typename enable_if<has_dynamic_bounds<Type>,
|
||||
typename enable_if<has_dynamic_bounds<Type>,
|
||||
typename Type::bounded_domain_type>::type
|
||||
reverse_bounded_upper(const Type& object)
|
||||
{
|
||||
return typename
|
||||
Type::bounded_domain_type(upper(object),
|
||||
object.bounds().reverse_right());
|
||||
{
|
||||
return typename
|
||||
Type::bounded_domain_type(upper(object),
|
||||
object.bounds().reverse_right());
|
||||
}
|
||||
|
||||
//- bounds ---------------------------------------------------------------------
|
||||
@@ -532,36 +536,36 @@ bounds(const Type&)
|
||||
template<class Type>
|
||||
typename boost::enable_if<is_asymmetric_interval<Type>, bool>::type
|
||||
is_empty(const Type& object)
|
||||
{
|
||||
return domain_less_equal<Type>(upper(object), lower(object));
|
||||
{
|
||||
return domain_less_equal<Type>(upper(object), lower(object));
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
typename boost::enable_if<is_static_closed<Type>, bool>::type
|
||||
is_empty(const Type& object)
|
||||
{
|
||||
return domain_less<Type>(upper(object), lower(object));
|
||||
{
|
||||
return domain_less<Type>(upper(object), lower(object));
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
typename boost::enable_if<is_static_open<Type>, bool>::type
|
||||
is_empty(const Type& object)
|
||||
{
|
||||
return domain_less_equal<Type>(upper(object), lower(object) )
|
||||
{
|
||||
return domain_less_equal<Type>(upper(object), lower(object) )
|
||||
|| domain_less_equal<Type>(upper(object), domain_next<Type>(lower(object)));
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
typename boost::enable_if<is_discrete_interval<Type>, bool>::type
|
||||
is_empty(const Type& object)
|
||||
{
|
||||
{
|
||||
if(object.bounds() == interval_bounds::closed())
|
||||
return domain_less<Type>(upper(object), lower(object));
|
||||
return domain_less<Type>(upper(object), lower(object));
|
||||
else if(object.bounds() == interval_bounds::open())
|
||||
return domain_less_equal<Type>(upper(object), lower(object) )
|
||||
|| domain_less_equal<Type>(upper(object), domain_next<Type>(lower(object)));
|
||||
else
|
||||
return domain_less_equal<Type>(upper(object), lower(object));
|
||||
return domain_less_equal<Type>(upper(object), lower(object));
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
@@ -582,32 +586,32 @@ namespace non_empty
|
||||
template<class Type>
|
||||
inline typename boost::enable_if<is_asymmetric_interval<Type>, bool>::type
|
||||
exclusive_less(const Type& left, const Type& right)
|
||||
{
|
||||
{
|
||||
BOOST_ASSERT(!(icl::is_empty(left) || icl::is_empty(right)));
|
||||
return domain_less_equal<Type>(upper(left), lower(right));
|
||||
return domain_less_equal<Type>(upper(left), lower(right));
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
inline typename boost::enable_if<is_discrete_interval<Type>, bool>::type
|
||||
exclusive_less(const Type& left, const Type& right)
|
||||
{
|
||||
{
|
||||
BOOST_ASSERT(!(icl::is_empty(left) || icl::is_empty(right)));
|
||||
return domain_less<Type>(last(left), first(right));
|
||||
return domain_less<Type>(last(left), first(right));
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
inline typename boost::
|
||||
enable_if<has_symmetric_bounds<Type>, bool>::type
|
||||
exclusive_less(const Type& left, const Type& right)
|
||||
{
|
||||
{
|
||||
BOOST_ASSERT(!(icl::is_empty(left) || icl::is_empty(right)));
|
||||
return domain_less<Type>(last(left), first(right));
|
||||
return domain_less<Type>(last(left), first(right));
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
inline typename boost::enable_if<is_continuous_interval<Type>, bool>::type
|
||||
exclusive_less(const Type& left, const Type& right)
|
||||
{
|
||||
{
|
||||
BOOST_ASSERT(!(icl::is_empty(left) || icl::is_empty(right)));
|
||||
return domain_less <Type>(upper(left), lower(right))
|
||||
|| ( domain_equal<Type>(upper(left), lower(right))
|
||||
@@ -617,7 +621,7 @@ namespace non_empty
|
||||
template<class Type>
|
||||
inline typename boost::enable_if<is_interval<Type>, bool>::type
|
||||
contains(const Type& super, const Type& sub)
|
||||
{
|
||||
{
|
||||
return lower_less_equal(super,sub) && upper_less_equal(sub,super);
|
||||
}
|
||||
|
||||
@@ -629,7 +633,7 @@ namespace non_empty
|
||||
template<class Type>
|
||||
inline typename boost::enable_if<is_interval<Type>, bool>::type
|
||||
contains(const Type& super, const Type& sub)
|
||||
{
|
||||
{
|
||||
return icl::is_empty(sub) || non_empty::contains(super, sub);
|
||||
}
|
||||
|
||||
@@ -637,7 +641,7 @@ template<class Type>
|
||||
typename boost::enable_if<is_discrete_static<Type>, bool>::type
|
||||
contains(const Type& super, const typename interval_traits<Type>::domain_type& element)
|
||||
{
|
||||
return domain_less_equal<Type>(icl::first(super), element )
|
||||
return domain_less_equal<Type>(icl::first(super), element )
|
||||
&& domain_less_equal<Type>( element, icl::last(super));
|
||||
}
|
||||
|
||||
@@ -645,7 +649,7 @@ template<class Type>
|
||||
typename boost::enable_if<is_continuous_left_open<Type>, bool>::type
|
||||
contains(const Type& super, const typename interval_traits<Type>::domain_type& element)
|
||||
{
|
||||
return domain_less <Type>(icl::lower(super), element )
|
||||
return domain_less <Type>(icl::lower(super), element )
|
||||
&& domain_less_equal<Type>( element, icl::upper(super));
|
||||
}
|
||||
|
||||
@@ -653,7 +657,7 @@ template<class Type>
|
||||
typename boost::enable_if<is_continuous_right_open<Type>, bool>::type
|
||||
contains(const Type& super, const typename interval_traits<Type>::domain_type& element)
|
||||
{
|
||||
return domain_less_equal<Type>(icl::lower(super), element )
|
||||
return domain_less_equal<Type>(icl::lower(super), element )
|
||||
&& domain_less <Type>( element, icl::upper(super));
|
||||
}
|
||||
|
||||
@@ -662,12 +666,12 @@ typename boost::enable_if<has_dynamic_bounds<Type>, bool>::type
|
||||
contains(const Type& super, const typename interval_traits<Type>::domain_type& element)
|
||||
{
|
||||
return
|
||||
(is_left_closed(super.bounds())
|
||||
? domain_less_equal<Type>(lower(super), element)
|
||||
(is_left_closed(super.bounds())
|
||||
? domain_less_equal<Type>(lower(super), element)
|
||||
: domain_less<Type>(lower(super), element))
|
||||
&&
|
||||
(is_right_closed(super.bounds())
|
||||
? domain_less_equal<Type>(element, upper(super))
|
||||
(is_right_closed(super.bounds())
|
||||
? domain_less_equal<Type>(element, upper(super))
|
||||
: domain_less<Type>(element, upper(super)));
|
||||
}
|
||||
|
||||
@@ -675,7 +679,7 @@ contains(const Type& super, const typename interval_traits<Type>::domain_type& e
|
||||
template<class Type>
|
||||
inline typename boost::enable_if<is_interval<Type>, bool>::type
|
||||
within(const Type& sub, const Type& super)
|
||||
{
|
||||
{
|
||||
return contains(super,sub);
|
||||
}
|
||||
|
||||
@@ -684,37 +688,37 @@ within(const Type& sub, const Type& super)
|
||||
//= Equivalences and Orderings
|
||||
//==============================================================================
|
||||
//- exclusive_less -------------------------------------------------------------
|
||||
/** Maximal element of <tt>left</tt> is less than the minimal element of
|
||||
/** Maximal element of <tt>left</tt> is less than the minimal element of
|
||||
<tt>right</tt> */
|
||||
template<class Type>
|
||||
inline typename boost::enable_if<is_asymmetric_interval<Type>, bool>::type
|
||||
exclusive_less(const Type& left, const Type& right)
|
||||
{
|
||||
{
|
||||
return icl::is_empty(left) || icl::is_empty(right)
|
||||
|| domain_less_equal<Type>(upper(left), lower(right));
|
||||
|| domain_less_equal<Type>(upper(left), lower(right));
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
inline typename boost::enable_if<is_discrete_interval<Type>, bool>::type
|
||||
exclusive_less(const Type& left, const Type& right)
|
||||
{
|
||||
{
|
||||
return icl::is_empty(left) || icl::is_empty(right)
|
||||
|| domain_less<Type>(last(left), first(right));
|
||||
|| domain_less<Type>(last(left), first(right));
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
inline typename boost::
|
||||
enable_if<has_symmetric_bounds<Type>, bool>::type
|
||||
exclusive_less(const Type& left, const Type& right)
|
||||
{
|
||||
{
|
||||
return icl::is_empty(left) || icl::is_empty(right)
|
||||
|| domain_less<Type>(last(left), first(right));
|
||||
|| domain_less<Type>(last(left), first(right));
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
inline typename boost::enable_if<is_continuous_interval<Type>, bool>::type
|
||||
exclusive_less(const Type& left, const Type& right)
|
||||
{
|
||||
{
|
||||
return icl::is_empty(left) || icl::is_empty(right)
|
||||
|| domain_less<Type>(upper(left), lower(right))
|
||||
|| ( domain_equal<Type>(upper(left), lower(right))
|
||||
@@ -729,24 +733,24 @@ lower_less(const Type& left, const Type& right)
|
||||
{
|
||||
return domain_less<Type>(lower(left), lower(right));
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
typename boost::enable_if<is_discrete_interval<Type>, bool>::type
|
||||
lower_less(const Type& left, const Type& right)
|
||||
{
|
||||
return domain_less<Type>(first(left), first(right));
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
typename boost::enable_if<is_continuous_interval<Type>, bool>::type
|
||||
lower_less(const Type& left, const Type& right)
|
||||
{
|
||||
if(left_bounds(left,right) == interval_bounds::right_open()) //'[(' == 10
|
||||
return domain_less_equal<Type>(lower(left), lower(right));
|
||||
else
|
||||
else
|
||||
return domain_less<Type>(lower(left), lower(right));
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template<class Type>
|
||||
@@ -762,7 +766,7 @@ upper_less(const Type& left, const Type& right)
|
||||
{
|
||||
return domain_less<Type>(last(left), last(right));
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
typename boost::enable_if<is_continuous_interval<Type>, bool>::type
|
||||
upper_less(const Type& left, const Type& right)
|
||||
@@ -772,10 +776,10 @@ upper_less(const Type& left, const Type& right)
|
||||
else
|
||||
return domain_less<Type>(upper(left), upper(right));
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template<class Type>
|
||||
typename boost::enable_if<has_dynamic_bounds<Type>,
|
||||
typename boost::enable_if<has_dynamic_bounds<Type>,
|
||||
typename Type::bounded_domain_type >::type
|
||||
lower_min(const Type& left, const Type& right)
|
||||
{
|
||||
@@ -784,7 +788,7 @@ lower_min(const Type& left, const Type& right)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template<class Type>
|
||||
typename boost::enable_if<has_dynamic_bounds<Type>,
|
||||
typename boost::enable_if<has_dynamic_bounds<Type>,
|
||||
typename Type::bounded_domain_type >::type
|
||||
lower_max(const Type& left, const Type& right)
|
||||
{
|
||||
@@ -793,7 +797,7 @@ lower_max(const Type& left, const Type& right)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template<class Type>
|
||||
typename boost::enable_if<has_dynamic_bounds<Type>,
|
||||
typename boost::enable_if<has_dynamic_bounds<Type>,
|
||||
typename Type::bounded_domain_type >::type
|
||||
upper_max(const Type& left, const Type& right)
|
||||
{
|
||||
@@ -802,7 +806,7 @@ upper_max(const Type& left, const Type& right)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template<class Type>
|
||||
typename boost::enable_if<has_dynamic_bounds<Type>,
|
||||
typename boost::enable_if<has_dynamic_bounds<Type>,
|
||||
typename Type::bounded_domain_type >::type
|
||||
upper_min(const Type& left, const Type& right)
|
||||
{
|
||||
@@ -892,7 +896,7 @@ template<class Type>
|
||||
typename boost::enable_if<is_interval<Type>, bool>::type
|
||||
operator == (const Type& left, const Type& right)
|
||||
{
|
||||
return (icl::is_empty(left) && icl::is_empty(right))
|
||||
return (icl::is_empty(left) && icl::is_empty(right))
|
||||
|| (lower_equal(left,right) && upper_equal(left,right));
|
||||
}
|
||||
|
||||
@@ -908,11 +912,11 @@ template<class Type>
|
||||
typename boost::enable_if<is_interval<Type>, bool>::type
|
||||
operator < (const Type& left, const Type& right)
|
||||
{
|
||||
if(icl::is_empty(left))
|
||||
if(icl::is_empty(left))
|
||||
return !icl::is_empty(right);
|
||||
else
|
||||
return lower_less(left,right)
|
||||
|| (lower_equal(left,right) && upper_less(left,right));
|
||||
else
|
||||
return lower_less(left,right)
|
||||
|| (lower_equal(left,right) && upper_less(left,right));
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
@@ -928,15 +932,15 @@ operator > (const Type& left, const Type& right)
|
||||
template<class Type>
|
||||
typename boost::enable_if<is_asymmetric_interval<Type>, bool>::type
|
||||
touches(const Type& left, const Type& right)
|
||||
{
|
||||
return domain_equal<Type>(upper(left), lower(right));
|
||||
{
|
||||
return domain_equal<Type>(upper(left), lower(right));
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
typename boost::enable_if<has_symmetric_bounds<Type>, bool>::type
|
||||
touches(const Type& left, const Type& right)
|
||||
{
|
||||
return domain_equal<Type>(last_next(left), first(right));
|
||||
{
|
||||
return domain_equal<Type>(last_next(left), first(right));
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
@@ -961,22 +965,22 @@ touches(const Type& left, const Type& right)
|
||||
//- cardinality ----------------------------------------------------------------
|
||||
|
||||
template<class Type>
|
||||
typename boost::enable_if<is_continuous_interval<Type>,
|
||||
typename boost::enable_if<is_continuous_interval<Type>,
|
||||
typename size_type_of<interval_traits<Type> >::type>::type
|
||||
cardinality(const Type& object)
|
||||
{
|
||||
typedef typename size_type_of<interval_traits<Type> >::type SizeT;
|
||||
if(icl::is_empty(object))
|
||||
return icl::identity_element<SizeT>::value();
|
||||
else if( object.bounds() == interval_bounds::closed()
|
||||
else if( object.bounds() == interval_bounds::closed()
|
||||
&& domain_equal<Type>(lower(object), upper(object)))
|
||||
return icl::unit_element<SizeT>::value();
|
||||
else
|
||||
else
|
||||
return icl::infinity<SizeT>::value();
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
typename boost::enable_if<is_discrete_interval<Type>,
|
||||
typename boost::enable_if<is_discrete_interval<Type>,
|
||||
typename size_type_of<interval_traits<Type> >::type>::type
|
||||
cardinality(const Type& object)
|
||||
{
|
||||
@@ -986,19 +990,19 @@ cardinality(const Type& object)
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
typename boost::enable_if<is_continuous_asymmetric<Type>,
|
||||
typename boost::enable_if<is_continuous_asymmetric<Type>,
|
||||
typename size_type_of<interval_traits<Type> >::type>::type
|
||||
cardinality(const Type& object)
|
||||
{
|
||||
typedef typename size_type_of<interval_traits<Type> >::type SizeT;
|
||||
if(icl::is_empty(object))
|
||||
return icl::identity_element<SizeT>::value();
|
||||
else
|
||||
else
|
||||
return icl::infinity<SizeT>::value();
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
typename boost::enable_if<is_discrete_asymmetric<Type>,
|
||||
typename boost::enable_if<is_discrete_asymmetric<Type>,
|
||||
typename size_type_of<interval_traits<Type> >::type>::type
|
||||
cardinality(const Type& object)
|
||||
{
|
||||
@@ -1008,7 +1012,7 @@ cardinality(const Type& object)
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
typename boost::enable_if<has_symmetric_bounds<Type>,
|
||||
typename boost::enable_if<has_symmetric_bounds<Type>,
|
||||
typename size_type_of<interval_traits<Type> >::type>::type
|
||||
cardinality(const Type& object)
|
||||
{
|
||||
@@ -1021,7 +1025,7 @@ cardinality(const Type& object)
|
||||
|
||||
//- size -----------------------------------------------------------------------
|
||||
template<class Type>
|
||||
inline typename enable_if<is_interval<Type>,
|
||||
inline typename enable_if<is_interval<Type>,
|
||||
typename size_type_of<interval_traits<Type> >::type>::type
|
||||
size(const Type& object)
|
||||
{
|
||||
@@ -1030,7 +1034,7 @@ size(const Type& object)
|
||||
|
||||
//- length ---------------------------------------------------------------------
|
||||
template<class Type>
|
||||
inline typename boost::enable_if<is_continuous_interval<Type>,
|
||||
inline typename boost::enable_if<is_continuous_interval<Type>,
|
||||
typename difference_type_of<interval_traits<Type> >::type>::type
|
||||
length(const Type& object)
|
||||
{
|
||||
@@ -1040,7 +1044,7 @@ length(const Type& object)
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
inline typename boost::enable_if<is_discrete_interval<Type>,
|
||||
inline typename boost::enable_if<is_discrete_interval<Type>,
|
||||
typename difference_type_of<interval_traits<Type> >::type>::type
|
||||
length(const Type& object)
|
||||
{
|
||||
@@ -1050,7 +1054,7 @@ length(const Type& object)
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
typename boost::enable_if<is_continuous_asymmetric<Type>,
|
||||
typename boost::enable_if<is_continuous_asymmetric<Type>,
|
||||
typename difference_type_of<interval_traits<Type> >::type>::type
|
||||
length(const Type& object)
|
||||
{
|
||||
@@ -1060,7 +1064,7 @@ length(const Type& object)
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
inline typename boost::enable_if<is_discrete_static<Type>,
|
||||
inline typename boost::enable_if<is_discrete_static<Type>,
|
||||
typename difference_type_of<interval_traits<Type> >::type>::type
|
||||
length(const Type& object)
|
||||
{
|
||||
@@ -1071,7 +1075,7 @@ length(const Type& object)
|
||||
|
||||
//- iterative_size -------------------------------------------------------------
|
||||
template<class Type>
|
||||
inline typename enable_if<is_interval<Type>,
|
||||
inline typename enable_if<is_interval<Type>,
|
||||
typename size_type_of<interval_traits<Type> >::type>::type
|
||||
iterative_size(const Type&)
|
||||
{
|
||||
@@ -1095,10 +1099,10 @@ hull(Type left, const Type& right)
|
||||
else if(icl::is_empty(left))
|
||||
return right;
|
||||
|
||||
return
|
||||
return
|
||||
construct<Type>
|
||||
(
|
||||
(std::min)(lower(left), lower(right), domain_compare()),
|
||||
(std::min)(lower(left), lower(right), domain_compare()),
|
||||
(std::max)(upper(left), upper(right), domain_compare())
|
||||
);
|
||||
}
|
||||
@@ -1114,7 +1118,7 @@ hull(Type left, const Type& right)
|
||||
|
||||
return dynamic_interval_traits<Type>::construct_bounded
|
||||
(
|
||||
lower_min(left, right),
|
||||
lower_min(left, right),
|
||||
upper_max(left, right)
|
||||
);
|
||||
}
|
||||
@@ -1123,7 +1127,7 @@ hull(Type left, const Type& right)
|
||||
//= Subtraction
|
||||
//==============================================================================
|
||||
//- left_subtract --------------------------------------------------------------
|
||||
/** subtract \c left_minuend from the \c right interval on it's left side.
|
||||
/** subtract \c left_minuend from the \c right interval on it's left side.
|
||||
Return the difference: The part of \c right right of \c left_minuend.
|
||||
\code
|
||||
right_over = right - left_minuend; //on the left.
|
||||
@@ -1137,7 +1141,7 @@ typename boost::enable_if<is_asymmetric_interval<Type>, Type>::type
|
||||
left_subtract(Type right, const Type& left_minuend)
|
||||
{
|
||||
if(exclusive_less(left_minuend, right))
|
||||
return right;
|
||||
return right;
|
||||
|
||||
return construct<Type>(upper(left_minuend), upper(right));
|
||||
}
|
||||
@@ -1147,7 +1151,7 @@ typename boost::enable_if<is_static_closed<Type>, Type>::type
|
||||
left_subtract(Type right, const Type& left_minuend)
|
||||
{
|
||||
if(exclusive_less(left_minuend, right))
|
||||
return right;
|
||||
return right;
|
||||
else if(upper_less_equal(right, left_minuend))
|
||||
return identity_element<Type>::value();
|
||||
|
||||
@@ -1159,7 +1163,7 @@ typename boost::enable_if<is_static_open<Type>, Type>::type
|
||||
left_subtract(Type right, const Type& left_minuend)
|
||||
{
|
||||
if(exclusive_less(left_minuend, right))
|
||||
return right;
|
||||
return right;
|
||||
|
||||
return construct<Type>(domain_prior<Type>(upper(left_minuend)), upper(right));
|
||||
}
|
||||
@@ -1169,14 +1173,14 @@ typename boost::enable_if<has_dynamic_bounds<Type>, Type>::type
|
||||
left_subtract(Type right, const Type& left_minuend)
|
||||
{
|
||||
if(exclusive_less(left_minuend, right))
|
||||
return right;
|
||||
return right;
|
||||
return dynamic_interval_traits<Type>::construct_bounded
|
||||
( reverse_bounded_upper(left_minuend), bounded_upper(right) );
|
||||
}
|
||||
|
||||
|
||||
//- right_subtract -------------------------------------------------------------
|
||||
/** subtract \c right_minuend from the \c left interval on it's right side.
|
||||
/** subtract \c right_minuend from the \c left interval on it's right side.
|
||||
Return the difference: The part of \c left left of \c right_minuend.
|
||||
\code
|
||||
left_over = left - right_minuend; //on the right side.
|
||||
@@ -1190,7 +1194,7 @@ typename boost::enable_if<is_asymmetric_interval<Type>, Type>::type
|
||||
right_subtract(Type left, const Type& right_minuend)
|
||||
{
|
||||
if(exclusive_less(left, right_minuend))
|
||||
return left;
|
||||
return left;
|
||||
return construct<Type>(lower(left), lower(right_minuend));
|
||||
}
|
||||
|
||||
@@ -1221,7 +1225,7 @@ typename boost::enable_if<has_dynamic_bounds<Type>, Type>::type
|
||||
right_subtract(Type left, const Type& right_minuend)
|
||||
{
|
||||
if(exclusive_less(left, right_minuend))
|
||||
return left;
|
||||
return left;
|
||||
|
||||
return dynamic_interval_traits<Type>::construct_bounded
|
||||
( bounded_lower(left), reverse_bounded_lower(right_minuend) );
|
||||
@@ -1272,11 +1276,11 @@ operator & (Type left, const Type& right)
|
||||
{
|
||||
if(icl::is_empty(left) || icl::is_empty(right))
|
||||
return identity_element<Type>::value();
|
||||
else
|
||||
else
|
||||
return dynamic_interval_traits<Type>::construct_bounded
|
||||
(
|
||||
lower_max(left, right),
|
||||
upper_min(left, right)
|
||||
lower_max(left, right),
|
||||
upper_min(left, right)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1285,18 +1289,18 @@ operator & (Type left, const Type& right)
|
||||
template<class Type>
|
||||
typename boost::enable_if<is_interval<Type>, bool>::type
|
||||
intersects(const Type& left, const Type& right)
|
||||
{
|
||||
return !( icl::is_empty(left) || icl::is_empty(right)
|
||||
|| exclusive_less(left,right) || exclusive_less(right,left));
|
||||
{
|
||||
return !( icl::is_empty(left) || icl::is_empty(right)
|
||||
|| exclusive_less(left,right) || exclusive_less(right,left));
|
||||
}
|
||||
|
||||
//- disjoint -------------------------------------------------------------------
|
||||
template<class Type>
|
||||
typename boost::enable_if<is_interval<Type>, bool>::type
|
||||
disjoint(const Type& left, const Type& right)
|
||||
{
|
||||
return icl::is_empty(left) || icl::is_empty(right)
|
||||
|| exclusive_less(left,right) || exclusive_less(right,left);
|
||||
{
|
||||
return icl::is_empty(left) || icl::is_empty(right)
|
||||
|| exclusive_less(left,right) || exclusive_less(right,left);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
@@ -1362,7 +1366,7 @@ inner_complement(const Type& left, const Type& right)
|
||||
template<class Type>
|
||||
inline typename boost::enable_if<is_interval<Type>, Type>::type
|
||||
between(const Type& left, const Type& right)
|
||||
{
|
||||
{
|
||||
return inner_complement(left, right);
|
||||
}
|
||||
|
||||
@@ -1375,7 +1379,7 @@ template<class Type>
|
||||
typename boost::
|
||||
enable_if< mpl::and_< is_interval<Type>
|
||||
, has_difference<typename interval_traits<Type>::domain_type>
|
||||
, is_discrete<typename interval_traits<Type>::domain_type>
|
||||
, is_discrete<typename interval_traits<Type>::domain_type>
|
||||
>
|
||||
, typename difference_type_of<interval_traits<Type> >::type>::type
|
||||
distance(const Type& x1, const Type& x2)
|
||||
@@ -1396,7 +1400,7 @@ template<class Type>
|
||||
typename boost::
|
||||
enable_if< mpl::and_< is_interval<Type>
|
||||
, has_difference<typename interval_traits<Type>::domain_type>
|
||||
, is_continuous<typename interval_traits<Type>::domain_type>
|
||||
, is_continuous<typename interval_traits<Type>::domain_type>
|
||||
>
|
||||
, typename difference_type_of<interval_traits<Type> >::type>::type
|
||||
distance(const Type& x1, const Type& x2)
|
||||
@@ -1430,9 +1434,9 @@ left_bracket(const Type&) { return "["; }
|
||||
|
||||
template<class Type>
|
||||
typename boost::enable_if<has_dynamic_bounds<Type>, std::string>::type
|
||||
left_bracket(const Type& object)
|
||||
{
|
||||
return left_bracket(object.bounds());
|
||||
left_bracket(const Type& object)
|
||||
{
|
||||
return left_bracket(object.bounds());
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -1450,28 +1454,27 @@ right_bracket(const Type&) { return "]"; }
|
||||
|
||||
template<class Type>
|
||||
typename boost::enable_if<has_dynamic_bounds<Type>, std::string>::type
|
||||
right_bracket(const Type& object)
|
||||
{
|
||||
return right_bracket(object.bounds());
|
||||
right_bracket(const Type& object)
|
||||
{
|
||||
return right_bracket(object.bounds());
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template<class CharType, class CharTraits, class Type>
|
||||
typename boost::enable_if<is_interval<Type>,
|
||||
typename boost::enable_if<is_interval<Type>,
|
||||
std::basic_ostream<CharType, CharTraits> >::type&
|
||||
operator << (std::basic_ostream<CharType, CharTraits> &stream, Type const& object)
|
||||
{
|
||||
if(boost::icl::is_empty(object))
|
||||
return stream << left_bracket<Type>(object) << right_bracket<Type>(object);
|
||||
return stream << left_bracket<Type>(object) << right_bracket<Type>(object);
|
||||
else
|
||||
return stream << left_bracket<Type>(object)
|
||||
<< interval_traits<Type>::lower(object)
|
||||
<< ","
|
||||
<< interval_traits<Type>::upper(object)
|
||||
return stream << left_bracket<Type>(object)
|
||||
<< interval_traits<Type>::lower(object)
|
||||
<< ","
|
||||
<< interval_traits<Type>::upper(object)
|
||||
<< right_bracket<Type>(object) ;
|
||||
}
|
||||
|
||||
}} // namespace icl boost
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ Copyright (c) 2010-2010: Joachim Faulhaber
|
||||
#ifndef BOOST_ICL_CONCEPT_INTERVAL_ASSOCIATOR_HPP_JOFA_100920
|
||||
#define BOOST_ICL_CONCEPT_INTERVAL_ASSOCIATOR_HPP_JOFA_100920
|
||||
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/icl/type_traits/domain_type_of.hpp>
|
||||
#include <boost/icl/type_traits/interval_type_of.hpp>
|
||||
#include <boost/icl/type_traits/is_combinable.hpp>
|
||||
@@ -1161,6 +1162,30 @@ elements_end(const Type& object)
|
||||
return typename Type::element_const_iterator(object.end());
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
typename enable_if
|
||||
<mpl::and_< is_interval_container<Type>
|
||||
, mpl::not_<is_continuous_interval<typename Type::interval_type> > >,
|
||||
iterator_range<typename Type::element_iterator> >::type
|
||||
elements(Type& object)
|
||||
{
|
||||
return
|
||||
make_iterator_range( typename Type::element_iterator(object.begin())
|
||||
, typename Type::element_iterator(object.end()) );
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
typename enable_if
|
||||
<mpl::and_< is_interval_container<Type>
|
||||
, mpl::not_<is_continuous_interval<typename Type::interval_type> > >,
|
||||
iterator_range<typename Type::element_const_iterator> >::type
|
||||
elements(Type const& object)
|
||||
{
|
||||
return
|
||||
make_iterator_range( typename Type::element_const_iterator(object.begin())
|
||||
, typename Type::element_const_iterator(object.end()) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//- Reverse
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
@@ -89,7 +89,7 @@ struct elemental;
|
||||
|
||||
template< class DomainT, class CodomainT,
|
||||
ICL_COMPARE Compare, ICL_INTERVAL(ICL_COMPARE) Interval >
|
||||
struct elemental<std::pair<ICL_INTERVAL_TYPE(Interval,DomainT,Compare)const, CodomainT> >
|
||||
struct elemental<std::pair<ICL_INTERVAL_TYPE(Interval,DomainT,Compare) const, CodomainT> >
|
||||
{
|
||||
typedef std::pair<ICL_INTERVAL_TYPE(Interval,DomainT,Compare), CodomainT> segment_type;
|
||||
typedef ICL_INTERVAL_TYPE(Interval,DomainT,Compare) interval_type;
|
||||
@@ -113,7 +113,7 @@ struct elemental;
|
||||
};
|
||||
|
||||
template< class CodomainT, ICL_INTERVAL(ICL_COMPARE) Interval >
|
||||
struct elemental<std::pair<ICL_INTERVAL_TYPE(Interval,DomainT,Compare)const, CodomainT> >
|
||||
struct elemental<std::pair<ICL_INTERVAL_TYPE(Interval,DomainT,Compare) const, CodomainT> >
|
||||
{
|
||||
typedef std::pair<ICL_INTERVAL_TYPE(Interval,DomainT,Compare), CodomainT> segment_type;
|
||||
typedef ICL_INTERVAL_TYPE(Interval,DomainT,Compare) interval_type;
|
||||
@@ -161,7 +161,7 @@ struct segment_adapter<SegmentIteratorT, ICL_INTERVAL_TYPE(Interval,DomainT,Comp
|
||||
|
||||
template < class SegmentIteratorT, class DomainT, class CodomainT,
|
||||
ICL_COMPARE Compare, ICL_INTERVAL(ICL_COMPARE) Interval >
|
||||
struct segment_adapter<SegmentIteratorT, std::pair<ICL_INTERVAL_TYPE(Interval,DomainT,Compare)const, CodomainT> >
|
||||
struct segment_adapter<SegmentIteratorT, std::pair<ICL_INTERVAL_TYPE(Interval,DomainT,Compare) const, CodomainT> >
|
||||
{
|
||||
typedef segment_adapter type;
|
||||
typedef ICL_INTERVAL_TYPE(Interval,DomainT,Compare) interval_type;
|
||||
@@ -214,7 +214,7 @@ struct segment_adapter
|
||||
};
|
||||
|
||||
template < class SegmentIteratorT, class CodomainT, ICL_INTERVAL(ICL_COMPARE) Interval >
|
||||
struct segment_adapter<SegmentIteratorT, std::pair<ICL_INTERVAL_TYPE(Interval,DomainT,Compare)const, CodomainT> >
|
||||
struct segment_adapter<SegmentIteratorT, std::pair<ICL_INTERVAL_TYPE(Interval,DomainT,Compare) const, CodomainT> >
|
||||
{
|
||||
typedef segment_adapter type;
|
||||
typedef ICL_INTERVAL_TYPE(Interval,DomainT,Compare) interval_type;
|
||||
|
||||
@@ -8,7 +8,6 @@ Copyright (c) 2007-2009: Joachim Faulhaber
|
||||
#ifndef BOOST_ICL_FUNCTORS_HPP_JOFA_080315
|
||||
#define BOOST_ICL_FUNCTORS_HPP_JOFA_080315
|
||||
|
||||
#include <functional>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/icl/type_traits/identity_element.hpp>
|
||||
@@ -20,15 +19,19 @@ namespace boost{namespace icl
|
||||
{
|
||||
// ------------------------------------------------------------------------
|
||||
template <typename Type> struct identity_based_inplace_combine
|
||||
: public std::binary_function<Type&, const Type&, void>
|
||||
{
|
||||
typedef Type& first_argument_type;
|
||||
typedef const Type& second_argument_type;
|
||||
typedef void result_type;
|
||||
inline static Type identity_element() { return boost::icl::identity_element<Type>::value(); }
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
template <typename Type> struct unit_element_based_inplace_combine
|
||||
: public std::binary_function<Type&, const Type&, void>
|
||||
{
|
||||
typedef Type& first_argument_type;
|
||||
typedef const Type& second_argument_type;
|
||||
typedef void result_type;
|
||||
inline static Type identity_element() { return boost::icl::unit_element<Type>::value(); }
|
||||
};
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ Copyright (c) 1999-2006: Cortex Software GmbH, Kantstrasse 57, Berlin
|
||||
#include <boost/icl/detail/design_config.hpp>
|
||||
#include <boost/icl/detail/on_absorbtion.hpp>
|
||||
#include <boost/icl/detail/interval_map_algo.hpp>
|
||||
#include <boost/icl/detail/exclusive_less_than.hpp>
|
||||
|
||||
#include <boost/icl/associative_interval_container.hpp>
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ Copyright (c) 1999-2006: Cortex Software GmbH, Kantstrasse 57, Berlin
|
||||
#endif
|
||||
|
||||
#include <limits>
|
||||
#include <boost/next_prior.hpp>
|
||||
#include <boost/next_prior.hpp>
|
||||
#include <boost/icl/associative_interval_container.hpp>
|
||||
#include <boost/icl/type_traits/interval_type_default.hpp>
|
||||
#include <boost/icl/interval.hpp>
|
||||
@@ -40,14 +40,14 @@ namespace boost{namespace icl
|
||||
{
|
||||
|
||||
/** \brief Implements a set as a set of intervals (base class) */
|
||||
template
|
||||
template
|
||||
<
|
||||
typename SubType,
|
||||
typename DomainT,
|
||||
typename DomainT,
|
||||
ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, DomainT),
|
||||
ICL_INTERVAL(ICL_COMPARE) Interval = ICL_INTERVAL_INSTANCE(ICL_INTERVAL_DEFAULT, DomainT, Compare),
|
||||
ICL_ALLOC Alloc = std::allocator
|
||||
>
|
||||
>
|
||||
class interval_base_set
|
||||
{
|
||||
public:
|
||||
@@ -115,7 +115,7 @@ public:
|
||||
/// allocator type of the corresponding element set
|
||||
typedef Alloc<DomainT> domain_allocator_type;
|
||||
|
||||
/// Container type for the implementation
|
||||
/// Container type for the implementation
|
||||
typedef typename ICL_IMPL_SPACE::set<interval_type,key_compare,allocator_type> ImplSetT;
|
||||
|
||||
/// key type of the implementing container
|
||||
@@ -144,15 +144,15 @@ public:
|
||||
typedef typename ImplSetT::const_reverse_iterator const_reverse_iterator;
|
||||
|
||||
/// element iterator: Depreciated, see documentation.
|
||||
typedef boost::icl::element_iterator<iterator> element_iterator;
|
||||
typedef boost::icl::element_iterator<iterator> element_iterator;
|
||||
/// element const iterator: Depreciated, see documentation.
|
||||
typedef boost::icl::element_iterator<const_iterator> element_const_iterator;
|
||||
typedef boost::icl::element_iterator<const_iterator> element_const_iterator;
|
||||
/// element reverse iterator: Depreciated, see documentation.
|
||||
typedef boost::icl::element_iterator<reverse_iterator> element_reverse_iterator;
|
||||
typedef boost::icl::element_iterator<reverse_iterator> element_reverse_iterator;
|
||||
/// element const reverse iterator: Depreciated, see documentation.
|
||||
typedef boost::icl::element_iterator<const_reverse_iterator> element_const_reverse_iterator;
|
||||
typedef boost::icl::element_iterator<const_reverse_iterator> element_const_reverse_iterator;
|
||||
|
||||
BOOST_STATIC_CONSTANT(int, fineness = 0);
|
||||
BOOST_STATIC_CONSTANT(int, fineness = 0);
|
||||
|
||||
public:
|
||||
//==========================================================================
|
||||
@@ -181,20 +181,20 @@ public:
|
||||
}
|
||||
|
||||
/** Move assignment operator */
|
||||
interval_base_set& operator = (interval_base_set src)
|
||||
interval_base_set& operator = (interval_base_set src)
|
||||
{ //call by value sice 'src' is a "sink value"
|
||||
this->_set = boost::move(src._set);
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
# else
|
||||
|
||||
/** Copy assignment operator */
|
||||
interval_base_set& operator = (const interval_base_set& src)
|
||||
{
|
||||
interval_base_set& operator = (const interval_base_set& src)
|
||||
{
|
||||
this->_set = src._set;
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
# endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
|
||||
@@ -220,9 +220,9 @@ public:
|
||||
}
|
||||
|
||||
/** Size of the iteration over this container */
|
||||
std::size_t iterative_size()const
|
||||
{
|
||||
return _set.size();
|
||||
std::size_t iterative_size()const
|
||||
{
|
||||
return _set.size();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
@@ -231,15 +231,15 @@ public:
|
||||
|
||||
/** Find the interval, that contains element \c key_value */
|
||||
const_iterator find(const element_type& key_value)const
|
||||
{
|
||||
{
|
||||
return icl::find(*this, key_value);
|
||||
//CL return this->_set.find(icl::singleton<segment_type>(key));
|
||||
//CL return this->_set.find(icl::singleton<segment_type>(key));
|
||||
}
|
||||
|
||||
/** Find the first interval, that collides with interval \c key_interval */
|
||||
const_iterator find(const interval_type& key_interval)const
|
||||
{
|
||||
return this->_set.find(key_interval);
|
||||
{
|
||||
return this->_set.find(key_interval);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
@@ -247,23 +247,23 @@ public:
|
||||
//==========================================================================
|
||||
|
||||
/** Add a single element \c key to the set */
|
||||
SubType& add(const element_type& key)
|
||||
SubType& add(const element_type& key)
|
||||
{
|
||||
return icl::add(*that(), key);
|
||||
}
|
||||
|
||||
/** Add an interval of elements \c inter_val to the set */
|
||||
SubType& add(const segment_type& inter_val)
|
||||
SubType& add(const segment_type& inter_val)
|
||||
{
|
||||
_add(inter_val);
|
||||
return *that();
|
||||
}
|
||||
|
||||
/** Add an interval of elements \c inter_val to the set. Iterator
|
||||
\c prior_ is a hint to the position \c inter_val can be
|
||||
/** Add an interval of elements \c inter_val to the set. Iterator
|
||||
\c prior_ is a hint to the position \c inter_val can be
|
||||
inserted after. */
|
||||
iterator add(iterator prior_, const segment_type& inter_val)
|
||||
{
|
||||
iterator add(iterator prior_, const segment_type& inter_val)
|
||||
{
|
||||
return _add(prior_, inter_val);
|
||||
}
|
||||
|
||||
@@ -272,35 +272,35 @@ public:
|
||||
//==========================================================================
|
||||
|
||||
/** Subtract a single element \c key from the set */
|
||||
SubType& subtract(const element_type& key)
|
||||
{
|
||||
SubType& subtract(const element_type& key)
|
||||
{
|
||||
return icl::subtract(*that(), key);
|
||||
}
|
||||
|
||||
/** Subtract an interval of elements \c inter_val from the set */
|
||||
SubType& subtract(const segment_type& inter_val);
|
||||
SubType& subtract(const segment_type& inter_val);
|
||||
|
||||
//==========================================================================
|
||||
//= Insertion
|
||||
//==========================================================================
|
||||
/** Insert an element \c key into the set */
|
||||
SubType& insert(const element_type& key)
|
||||
{
|
||||
return add(key);
|
||||
SubType& insert(const element_type& key)
|
||||
{
|
||||
return add(key);
|
||||
}
|
||||
|
||||
/** Insert an interval of elements \c inter_val to the set */
|
||||
SubType& insert(const segment_type& inter_val)
|
||||
{
|
||||
return add(inter_val);
|
||||
SubType& insert(const segment_type& inter_val)
|
||||
{
|
||||
return add(inter_val);
|
||||
}
|
||||
|
||||
/** Insert an interval of elements \c inter_val to the set. Iterator
|
||||
\c prior_ is a hint to the position \c inter_val can be
|
||||
/** Insert an interval of elements \c inter_val to the set. Iterator
|
||||
\c prior_ is a hint to the position \c inter_val can be
|
||||
inserted after. */
|
||||
iterator insert(iterator prior_, const segment_type& inter_val)
|
||||
{
|
||||
return add(prior_, inter_val);
|
||||
iterator insert(iterator prior_, const segment_type& inter_val)
|
||||
{
|
||||
return add(prior_, inter_val);
|
||||
}
|
||||
|
||||
|
||||
@@ -309,27 +309,27 @@ public:
|
||||
//= Erasure
|
||||
//==========================================================================
|
||||
/** Erase an element \c key from the set */
|
||||
SubType& erase(const element_type& key)
|
||||
{
|
||||
return subtract(key);
|
||||
SubType& erase(const element_type& key)
|
||||
{
|
||||
return subtract(key);
|
||||
}
|
||||
|
||||
/** Erase an interval of elements \c inter_val from the set */
|
||||
SubType& erase(const segment_type& inter_val)
|
||||
{
|
||||
return subtract(inter_val);
|
||||
SubType& erase(const segment_type& inter_val)
|
||||
{
|
||||
return subtract(inter_val);
|
||||
}
|
||||
|
||||
/** Erase the interval that iterator \c position points to. */
|
||||
void erase(iterator position)
|
||||
{
|
||||
_set.erase(position);
|
||||
{
|
||||
_set.erase(position);
|
||||
}
|
||||
|
||||
/** Erase all intervals in the range <tt>[first,past)</tt> of iterators. */
|
||||
void erase(iterator first, iterator past)
|
||||
{
|
||||
_set.erase(first, past);
|
||||
{
|
||||
_set.erase(first, past);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
@@ -373,16 +373,16 @@ public:
|
||||
{ return _set.upper_bound(interval); }
|
||||
|
||||
std::pair<iterator,iterator> equal_range(const key_type& interval)
|
||||
{
|
||||
{
|
||||
return std::pair<iterator,iterator>
|
||||
(_set.lower_bound(interval), _set.upper_bound(interval));
|
||||
(_set.lower_bound(interval), _set.upper_bound(interval));
|
||||
}
|
||||
|
||||
std::pair<const_iterator,const_iterator>
|
||||
std::pair<const_iterator,const_iterator>
|
||||
equal_range(const key_type& interval)const
|
||||
{
|
||||
{
|
||||
return std::pair<const_iterator,const_iterator>
|
||||
(_set.lower_bound(interval), _set.upper_bound(interval));
|
||||
(_set.lower_bound(interval), _set.upper_bound(interval));
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -437,7 +437,7 @@ inline void interval_base_set<SubType,DomainT,Compare,Interval,Alloc>
|
||||
if(!icl::is_empty(lead_gap))
|
||||
// [lead_gap--- . . .
|
||||
// [prior_) [-- it_ ...
|
||||
this->_set.insert(prior(it_), lead_gap);
|
||||
this->_set.insert(cyclic_prior(*this, it_), lead_gap);
|
||||
|
||||
// . . . --------- . . . addend interval
|
||||
// [-- it_ --) has a common part with the first overval
|
||||
@@ -470,7 +470,7 @@ inline void interval_base_set<SubType,DomainT,Compare,Interval,Alloc>
|
||||
// [lead_gap--- . . .
|
||||
// [prior_) [-- it_ ...
|
||||
this->_set.insert(prior_, lead_gap);
|
||||
|
||||
|
||||
interval_type end_gap = left_subtract(inter_val, cur_itv);
|
||||
if(!icl::is_empty(end_gap))
|
||||
// [---------------end_gap)
|
||||
@@ -495,12 +495,12 @@ inline void interval_base_set<SubType,DomainT,Compare,Interval,Alloc>
|
||||
//= Addition
|
||||
//==============================================================================
|
||||
template <class SubType, class DomainT, ICL_COMPARE Compare, ICL_INTERVAL(ICL_COMPARE) Interval, ICL_ALLOC Alloc>
|
||||
inline typename interval_base_set<SubType,DomainT,Compare,Interval,Alloc>::iterator
|
||||
inline typename interval_base_set<SubType,DomainT,Compare,Interval,Alloc>::iterator
|
||||
interval_base_set<SubType,DomainT,Compare,Interval,Alloc>
|
||||
::_add(const segment_type& addend)
|
||||
{
|
||||
typedef typename interval_base_set<SubType,DomainT,Compare,Interval,Alloc>::iterator iterator;
|
||||
if(icl::is_empty(addend))
|
||||
if(icl::is_empty(addend))
|
||||
return this->_set.end();
|
||||
|
||||
std::pair<iterator,bool> insertion = this->_set.insert(addend);
|
||||
@@ -515,7 +515,7 @@ inline typename interval_base_set<SubType,DomainT,Compare,Interval,Alloc>::itera
|
||||
}
|
||||
|
||||
template <class SubType, class DomainT, ICL_COMPARE Compare, ICL_INTERVAL(ICL_COMPARE) Interval, ICL_ALLOC Alloc>
|
||||
inline typename interval_base_set<SubType,DomainT,Compare,Interval,Alloc>::iterator
|
||||
inline typename interval_base_set<SubType,DomainT,Compare,Interval,Alloc>::iterator
|
||||
interval_base_set<SubType,DomainT,Compare,Interval,Alloc>
|
||||
::_add(iterator prior_, const segment_type& addend)
|
||||
{
|
||||
@@ -541,11 +541,11 @@ template <class SubType, class DomainT, ICL_COMPARE Compare, ICL_INTERVAL(ICL_CO
|
||||
inline SubType& interval_base_set<SubType,DomainT,Compare,Interval,Alloc>
|
||||
::subtract(const segment_type& minuend)
|
||||
{
|
||||
if(icl::is_empty(minuend))
|
||||
if(icl::is_empty(minuend))
|
||||
return *that();
|
||||
|
||||
std::pair<iterator, iterator> exterior = equal_range(minuend);
|
||||
if(exterior.first == exterior.second)
|
||||
if(exterior.first == exterior.second)
|
||||
return *that();
|
||||
|
||||
iterator first_ = exterior.first;
|
||||
@@ -553,7 +553,7 @@ inline SubType& interval_base_set<SubType,DomainT,Compare,Interval,Alloc>
|
||||
iterator last_ = prior(end_);
|
||||
|
||||
interval_type left_resid = right_subtract(*first_, minuend);
|
||||
interval_type right_resid;
|
||||
interval_type right_resid;
|
||||
if(first_ != end_)
|
||||
right_resid = left_subtract(*last_ , minuend);
|
||||
|
||||
@@ -574,17 +574,17 @@ inline SubType& interval_base_set<SubType,DomainT,Compare,Interval,Alloc>
|
||||
template<class SubType,
|
||||
class DomainT, ICL_COMPARE Compare, ICL_INTERVAL(ICL_COMPARE) Interval, ICL_ALLOC Alloc>
|
||||
struct is_set<icl::interval_base_set<SubType,DomainT,Compare,Interval,Alloc> >
|
||||
{
|
||||
{
|
||||
typedef is_set<icl::interval_base_set<SubType,DomainT,Compare,Interval,Alloc> > type;
|
||||
BOOST_STATIC_CONSTANT(bool, value = true);
|
||||
BOOST_STATIC_CONSTANT(bool, value = true);
|
||||
};
|
||||
|
||||
template<class SubType,
|
||||
class DomainT, ICL_COMPARE Compare, ICL_INTERVAL(ICL_COMPARE) Interval, ICL_ALLOC Alloc>
|
||||
struct is_interval_container<icl::interval_base_set<SubType,DomainT,Compare,Interval,Alloc> >
|
||||
{
|
||||
{
|
||||
typedef is_interval_container<icl::interval_base_set<SubType,DomainT,Compare,Interval,Alloc> > type;
|
||||
BOOST_STATIC_CONSTANT(bool, value = true);
|
||||
BOOST_STATIC_CONSTANT(bool, value = true);
|
||||
};
|
||||
|
||||
|
||||
@@ -592,5 +592,3 @@ struct is_interval_container<icl::interval_base_set<SubType,DomainT,Compare,Inte
|
||||
}} // namespace icl boost
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -41,8 +41,8 @@ public:
|
||||
interval_bounds all ()const { return interval_bounds(_bits & _all ); }
|
||||
interval_bounds left ()const { return interval_bounds(_bits & _left ); }
|
||||
interval_bounds right()const { return interval_bounds(_bits & _right); }
|
||||
interval_bounds reverse_left ()const { return interval_bounds((~_bits>>1) & _right); }
|
||||
interval_bounds reverse_right()const { return interval_bounds((~_bits<<1) & _left ); }
|
||||
interval_bounds reverse_left ()const { return interval_bounds((bound_type(~_bits)>>1) & _right); }
|
||||
interval_bounds reverse_right()const { return interval_bounds((bound_type(~_bits)<<1) & _left ); }
|
||||
|
||||
bound_type bits()const{ return _bits; }
|
||||
|
||||
|
||||
@@ -16,12 +16,15 @@ namespace boost{namespace icl
|
||||
|
||||
/** \brief Performes an addition using a container's memberfunction add, when operator= is called. */
|
||||
template<class ContainerT> class add_iterator
|
||||
: public std::iterator<std::output_iterator_tag, void, void, void, void>
|
||||
{
|
||||
public:
|
||||
/// The container's type.
|
||||
typedef ContainerT container_type;
|
||||
typedef std::output_iterator_tag iterator_category;
|
||||
typedef void value_type;
|
||||
typedef void difference_type;
|
||||
typedef void pointer;
|
||||
typedef void reference;
|
||||
|
||||
/** An add_iterator is constructed with a container and a position
|
||||
that has to be maintained. */
|
||||
@@ -57,12 +60,15 @@ inline add_iterator<ContainerT> adder(ContainerT& cont, IteratorT iter_)
|
||||
|
||||
/** \brief Performes an insertion using a container's memberfunction add, when operator= is called. */
|
||||
template<class ContainerT> class insert_iterator
|
||||
: public std::iterator<std::output_iterator_tag, void, void, void, void>
|
||||
{
|
||||
public:
|
||||
/// The container's type.
|
||||
typedef ContainerT container_type;
|
||||
typedef std::output_iterator_tag iterator_category;
|
||||
typedef void value_type;
|
||||
typedef void difference_type;
|
||||
typedef void pointer;
|
||||
typedef void reference;
|
||||
|
||||
/** An insert_iterator is constructed with a container and a position
|
||||
that has to be maintained. */
|
||||
|
||||
@@ -22,7 +22,7 @@ Copyright (c) 2007-2011: Joachim Faulhaber
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <boost/call_traits.hpp>
|
||||
#include <boost/call_traits.hpp>
|
||||
#include <boost/icl/detail/notate.hpp>
|
||||
#include <boost/icl/detail/design_config.hpp>
|
||||
#include <boost/icl/detail/concept_check.hpp>
|
||||
@@ -32,10 +32,10 @@ Copyright (c) 2007-2011: Joachim Faulhaber
|
||||
#include <boost/icl/type_traits/is_total.hpp>
|
||||
#include <boost/icl/type_traits/is_element_container.hpp>
|
||||
#include <boost/icl/type_traits/has_inverse.hpp>
|
||||
#include <boost/icl/type_traits/to_string.hpp>
|
||||
|
||||
#include <boost/icl/associative_element_container.hpp>
|
||||
#include <boost/icl/functors.hpp>
|
||||
#include <boost/icl/type_traits/to_string.hpp>
|
||||
|
||||
namespace boost{namespace icl
|
||||
{
|
||||
@@ -46,7 +46,7 @@ struct partial_absorber
|
||||
enum { is_total = false };
|
||||
};
|
||||
|
||||
template<>
|
||||
template<>
|
||||
inline std::string type_to_string<partial_absorber>::apply() { return "@0"; }
|
||||
|
||||
struct partial_enricher
|
||||
@@ -55,7 +55,7 @@ struct partial_enricher
|
||||
enum { is_total = false };
|
||||
};
|
||||
|
||||
template<>
|
||||
template<>
|
||||
inline std::string type_to_string<partial_enricher>::apply() { return "e0"; }
|
||||
|
||||
struct total_absorber
|
||||
@@ -64,7 +64,7 @@ struct total_absorber
|
||||
enum { is_total = true };
|
||||
};
|
||||
|
||||
template<>
|
||||
template<>
|
||||
inline std::string type_to_string<total_absorber>::apply() { return "^0"; }
|
||||
|
||||
struct total_enricher
|
||||
@@ -73,23 +73,23 @@ struct total_enricher
|
||||
enum { is_total = true };
|
||||
};
|
||||
|
||||
template<>
|
||||
template<>
|
||||
inline std::string type_to_string<total_enricher>::apply() { return "e^0"; }
|
||||
|
||||
|
||||
|
||||
/** \brief Addable, subractable and intersectable maps */
|
||||
template
|
||||
template
|
||||
<
|
||||
typename DomainT,
|
||||
typename CodomainT,
|
||||
typename DomainT,
|
||||
typename CodomainT,
|
||||
class Traits = icl::partial_absorber,
|
||||
ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, DomainT),
|
||||
ICL_COMBINE Combine = ICL_COMBINE_INSTANCE(icl::inplace_plus, CodomainT),
|
||||
ICL_SECTION Section = ICL_SECTION_INSTANCE(icl::inter_section, CodomainT),
|
||||
ICL_ALLOC Alloc = std::allocator
|
||||
ICL_SECTION Section = ICL_SECTION_INSTANCE(icl::inter_section, CodomainT),
|
||||
ICL_ALLOC Alloc = std::allocator
|
||||
>
|
||||
class map: private ICL_IMPL_SPACE::map<DomainT, CodomainT, ICL_COMPARE_DOMAIN(Compare,DomainT),
|
||||
class map: private ICL_IMPL_SPACE::map<DomainT, CodomainT, ICL_COMPARE_DOMAIN(Compare,DomainT),
|
||||
Alloc<std::pair<const DomainT, CodomainT> > >
|
||||
{
|
||||
public:
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
typedef typename inverse<codomain_combine >::type inverse_codomain_combine;
|
||||
typedef typename mpl::if_
|
||||
<has_set_semantics<codomain_type>
|
||||
, ICL_SECTION_CODOMAIN(Section,CodomainT)
|
||||
, ICL_SECTION_CODOMAIN(Section,CodomainT)
|
||||
, codomain_combine
|
||||
>::type codomain_intersect;
|
||||
typedef typename inverse<codomain_intersect>::type inverse_codomain_intersect;
|
||||
@@ -129,10 +129,10 @@ public:
|
||||
|
||||
BOOST_STATIC_CONSTANT(bool, _total = (Traits::is_total));
|
||||
BOOST_STATIC_CONSTANT(bool, _absorbs = (Traits::absorbs_identities));
|
||||
BOOST_STATIC_CONSTANT(bool,
|
||||
BOOST_STATIC_CONSTANT(bool,
|
||||
total_invertible = (mpl::and_<is_total<type>, has_inverse<codomain_type> >::value));
|
||||
|
||||
typedef on_absorbtion<type,codomain_combine,Traits::absorbs_identities>
|
||||
typedef on_absorbtion<type,codomain_combine,Traits::absorbs_identities>
|
||||
on_identity_absorbtion;
|
||||
|
||||
public:
|
||||
@@ -148,11 +148,11 @@ public:
|
||||
typedef typename base_type::const_reverse_iterator const_reverse_iterator;
|
||||
|
||||
public:
|
||||
BOOST_STATIC_CONSTANT(bool,
|
||||
is_total_invertible = ( Traits::is_total
|
||||
BOOST_STATIC_CONSTANT(bool,
|
||||
is_total_invertible = ( Traits::is_total
|
||||
&& has_inverse<codomain_type>::value));
|
||||
|
||||
BOOST_STATIC_CONSTANT(int, fineness = 4);
|
||||
BOOST_STATIC_CONSTANT(int, fineness = 4);
|
||||
|
||||
public:
|
||||
//==========================================================================
|
||||
@@ -170,11 +170,11 @@ public:
|
||||
|
||||
template <class InputIterator>
|
||||
map(InputIterator first, InputIterator past)
|
||||
: base_type(first,past){}
|
||||
: base_type(first,past){}
|
||||
|
||||
template <class InputIterator>
|
||||
map(InputIterator first, InputIterator past, const key_compare& comp)
|
||||
: base_type(first,past,comp)
|
||||
: base_type(first,past,comp)
|
||||
{}
|
||||
|
||||
map(const map& src)
|
||||
@@ -187,8 +187,8 @@ public:
|
||||
}
|
||||
|
||||
explicit map(const element_type& key_value_pair): base_type::map()
|
||||
{
|
||||
insert(key_value_pair);
|
||||
{
|
||||
insert(key_value_pair);
|
||||
}
|
||||
|
||||
# ifndef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
|
||||
@@ -205,19 +205,19 @@ public:
|
||||
BOOST_CONCEPT_ASSERT((EqualComparableConcept<CodomainT>));
|
||||
}
|
||||
|
||||
map& operator = (map src)
|
||||
{
|
||||
map& operator = (map src)
|
||||
{
|
||||
base_type::operator=(boost::move(src));
|
||||
return *this;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
//==========================================================================
|
||||
# else
|
||||
|
||||
map& operator = (const map& src)
|
||||
{
|
||||
map& operator = (const map& src)
|
||||
{
|
||||
base_type::operator=(src);
|
||||
return *this;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
# endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
|
||||
|
||||
@@ -254,10 +254,10 @@ public:
|
||||
//==========================================================================
|
||||
|
||||
template<class SubObject>
|
||||
bool contains(const SubObject& sub)const
|
||||
bool contains(const SubObject& sub)const
|
||||
{ return icl::contains(*this, sub); }
|
||||
|
||||
bool within(const map& super)const
|
||||
bool within(const map& super)const
|
||||
{ return icl::contains(super, *this); }
|
||||
|
||||
//==========================================================================
|
||||
@@ -275,7 +275,7 @@ public:
|
||||
/** Total select function. */
|
||||
codomain_type operator()(const domain_type& key)const
|
||||
{
|
||||
const_iterator it = find(key);
|
||||
const_iterator it = find(key);
|
||||
return it==end() ? identity_element<codomain_type>::value()
|
||||
: it->second;
|
||||
}
|
||||
@@ -283,20 +283,20 @@ public:
|
||||
//==========================================================================
|
||||
//= Addition
|
||||
//==========================================================================
|
||||
/** \c add inserts \c value_pair into the map if it's key does
|
||||
not exist in the map.
|
||||
/** \c add inserts \c value_pair into the map if it's key does
|
||||
not exist in the map.
|
||||
If \c value_pairs's key value exists in the map, it's data
|
||||
value is added to the data value already found in the map. */
|
||||
map& add(const value_type& value_pair)
|
||||
{
|
||||
return _add<codomain_combine>(value_pair);
|
||||
map& add(const value_type& value_pair)
|
||||
{
|
||||
return _add<codomain_combine>(value_pair);
|
||||
}
|
||||
|
||||
/** \c add add \c value_pair into the map using \c prior as a hint to
|
||||
insert \c value_pair after the position \c prior is pointing to. */
|
||||
iterator add(iterator prior, const value_type& value_pair)
|
||||
{
|
||||
return _add<codomain_combine>(prior, value_pair);
|
||||
iterator add(iterator prior, const value_type& value_pair)
|
||||
{
|
||||
return _add<codomain_combine>(prior, value_pair);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
@@ -322,15 +322,15 @@ public:
|
||||
//==========================================================================
|
||||
std::pair<iterator,bool> insert(const value_type& value_pair)
|
||||
{
|
||||
if(on_identity_absorbtion::is_absorbable(value_pair.second))
|
||||
if(on_identity_absorbtion::is_absorbable(value_pair.second))
|
||||
return std::pair<iterator,bool>(end(),true);
|
||||
else
|
||||
return base_type::insert(value_pair);
|
||||
}
|
||||
|
||||
|
||||
iterator insert(iterator prior, const value_type& value_pair)
|
||||
{
|
||||
if(on_identity_absorbtion::is_absorbable(value_pair.second))
|
||||
if(on_identity_absorbtion::is_absorbable(value_pair.second))
|
||||
return end();
|
||||
else
|
||||
return base_type::insert(prior, value_pair);
|
||||
@@ -346,7 +346,7 @@ public:
|
||||
|
||||
/** With <tt>key_value_pair = (k,v)</tt> set value \c v for key \c k */
|
||||
map& set(const element_type& key_value_pair)
|
||||
{
|
||||
{
|
||||
return icl::set_at(*this, key_value_pair);
|
||||
}
|
||||
|
||||
@@ -354,7 +354,7 @@ public:
|
||||
Erase only if, the exact value content \c val is stored for the given key. */
|
||||
size_type erase(const element_type& key_value_pair)
|
||||
{
|
||||
return icl::erase(*this, key_value_pair);
|
||||
return icl::erase(*this, key_value_pair);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
@@ -400,7 +400,7 @@ private:
|
||||
if(it_ != end())
|
||||
{
|
||||
section.template _add<codomain_combine >(*it_);
|
||||
section.template _add<codomain_intersect>(operand);
|
||||
section.template _add<codomain_intersect>(operand);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -441,7 +441,7 @@ private:
|
||||
template<class Type>
|
||||
struct on_definedness<Type, true>
|
||||
{
|
||||
static void add_intersection(Type& section, const Type& object,
|
||||
static void add_intersection(Type& section, const Type& object,
|
||||
const element_type& operand)
|
||||
{ object.total_add_intersection(section, operand); }
|
||||
};
|
||||
@@ -449,7 +449,7 @@ private:
|
||||
template<class Type>
|
||||
struct on_definedness<Type, false>
|
||||
{
|
||||
static void add_intersection(Type& section, const Type& object,
|
||||
static void add_intersection(Type& section, const Type& object,
|
||||
const element_type& operand)
|
||||
{ object.partial_add_intersection(section, operand); }
|
||||
};
|
||||
@@ -465,7 +465,7 @@ private:
|
||||
template<class Type>
|
||||
struct on_codomain_model<Type, false, false>
|
||||
{ // !codomain_is_set, !absorbs_identities
|
||||
static void subtract(Type&, typename Type::iterator it_,
|
||||
static void subtract(Type&, typename Type::iterator it_,
|
||||
const typename Type::codomain_type& )
|
||||
{ (*it_).second = identity_element<typename Type::codomain_type>::value(); }
|
||||
};
|
||||
@@ -473,7 +473,7 @@ private:
|
||||
template<class Type>
|
||||
struct on_codomain_model<Type, false, true>
|
||||
{ // !codomain_is_set, absorbs_identities
|
||||
static void subtract(Type& object, typename Type::iterator it_,
|
||||
static void subtract(Type& object, typename Type::iterator it_,
|
||||
const typename Type::codomain_type& )
|
||||
{ object.erase(it_); }
|
||||
};
|
||||
@@ -482,10 +482,10 @@ private:
|
||||
struct on_codomain_model<Type, true, false>
|
||||
{ // !codomain_is_set, !absorbs_identities
|
||||
typedef typename Type::inverse_codomain_intersect inverse_codomain_intersect;
|
||||
static void subtract(Type&, typename Type::iterator it_,
|
||||
static void subtract(Type&, typename Type::iterator it_,
|
||||
const typename Type::codomain_type& co_value)
|
||||
{
|
||||
inverse_codomain_intersect()((*it_).second, co_value);
|
||||
{
|
||||
inverse_codomain_intersect()((*it_).second, co_value);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -493,10 +493,10 @@ private:
|
||||
struct on_codomain_model<Type, true, true>
|
||||
{ // !codomain_is_set, absorbs_identities
|
||||
typedef typename Type::inverse_codomain_intersect inverse_codomain_intersect;
|
||||
static void subtract(Type& object, typename Type::iterator it_,
|
||||
static void subtract(Type& object, typename Type::iterator it_,
|
||||
const typename Type::codomain_type& co_value)
|
||||
{
|
||||
inverse_codomain_intersect()((*it_).second, co_value);
|
||||
{
|
||||
inverse_codomain_intersect()((*it_).second, co_value);
|
||||
if((*it_).second == identity_element<codomain_type>::value())
|
||||
object.erase(it_);
|
||||
}
|
||||
@@ -522,7 +522,7 @@ private:
|
||||
typedef typename Type::codomain_type codomain_type;
|
||||
|
||||
static void flip(Type& object, const element_type& operand)
|
||||
{
|
||||
{
|
||||
object.add(operand);
|
||||
ICL_FORALL(typename Type, it_, object)
|
||||
(*it_).second = identity_element<codomain_type>::value();
|
||||
@@ -588,7 +588,7 @@ map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>&
|
||||
if(on_absorbtion_::is_absorbable(co_val))
|
||||
return *this;
|
||||
|
||||
std::pair<iterator,bool> insertion
|
||||
std::pair<iterator,bool> insertion
|
||||
= base_type::insert(value_type(addend.first, version<Combiner>()(co_val)));
|
||||
|
||||
if(!insertion.second)
|
||||
@@ -616,8 +616,8 @@ typename map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>::iterator
|
||||
if(on_absorbtion_::is_absorbable(co_val))
|
||||
return end();
|
||||
|
||||
iterator inserted_
|
||||
= base_type::insert(prior_,
|
||||
iterator inserted_
|
||||
= base_type::insert(prior_,
|
||||
value_type(addend.first, Combiner::identity_element()));
|
||||
Combiner()((*inserted_).second, addend.second);
|
||||
|
||||
@@ -658,30 +658,30 @@ map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>&
|
||||
//-----------------------------------------------------------------------------
|
||||
template <class DomainT, class CodomainT, class Traits, ICL_COMPARE Compare, ICL_COMBINE Combine, ICL_SECTION Section, ICL_ALLOC Alloc>
|
||||
struct is_map<icl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc> >
|
||||
{
|
||||
{
|
||||
typedef is_map<icl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc> > type;
|
||||
BOOST_STATIC_CONSTANT(bool, value = true);
|
||||
BOOST_STATIC_CONSTANT(bool, value = true);
|
||||
};
|
||||
|
||||
template <class DomainT, class CodomainT, class Traits, ICL_COMPARE Compare, ICL_COMBINE Combine, ICL_SECTION Section, ICL_ALLOC Alloc>
|
||||
struct has_inverse<icl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc> >
|
||||
{
|
||||
{
|
||||
typedef has_inverse<icl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc> > type;
|
||||
BOOST_STATIC_CONSTANT(bool, value = (has_inverse<CodomainT>::value));
|
||||
BOOST_STATIC_CONSTANT(bool, value = (has_inverse<CodomainT>::value));
|
||||
};
|
||||
|
||||
template <class DomainT, class CodomainT, class Traits, ICL_COMPARE Compare, ICL_COMBINE Combine, ICL_SECTION Section, ICL_ALLOC Alloc>
|
||||
struct absorbs_identities<icl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc> >
|
||||
{
|
||||
{
|
||||
typedef absorbs_identities type;
|
||||
BOOST_STATIC_CONSTANT(int, value = Traits::absorbs_identities);
|
||||
BOOST_STATIC_CONSTANT(int, value = Traits::absorbs_identities);
|
||||
};
|
||||
|
||||
template <class DomainT, class CodomainT, class Traits, ICL_COMPARE Compare, ICL_COMBINE Combine, ICL_SECTION Section, ICL_ALLOC Alloc>
|
||||
struct is_total<icl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc> >
|
||||
{
|
||||
{
|
||||
typedef is_total type;
|
||||
BOOST_STATIC_CONSTANT(int, value = Traits::is_total);
|
||||
BOOST_STATIC_CONSTANT(int, value = Traits::is_total);
|
||||
};
|
||||
|
||||
template <class DomainT, class CodomainT, class Traits, ICL_COMPARE Compare, ICL_COMBINE Combine, ICL_SECTION Section, ICL_ALLOC Alloc>
|
||||
@@ -691,7 +691,7 @@ struct type_to_string<icl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,
|
||||
{
|
||||
return "map<"+ type_to_string<DomainT>::apply() + ","
|
||||
+ type_to_string<CodomainT>::apply() + ","
|
||||
+ type_to_string<Traits>::apply() +">";
|
||||
+ type_to_string<Traits>::apply() +">";
|
||||
}
|
||||
};
|
||||
|
||||
@@ -700,4 +700,3 @@ struct type_to_string<icl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,
|
||||
}} // namespace icl boost
|
||||
|
||||
#endif // BOOST_ICL_MAP_HPP_JOFA_070519
|
||||
|
||||
|
||||
@@ -8,8 +8,6 @@ Copyright (c) 2010-2010: Joachim Faulhaber
|
||||
#ifndef BOOST_ICL_TYPE_TRAITS_PREDICATE_HPP_JOFA_101102
|
||||
#define BOOST_ICL_TYPE_TRAITS_PREDICATE_HPP_JOFA_101102
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace boost{namespace icl
|
||||
{
|
||||
// naming convention
|
||||
@@ -20,7 +18,12 @@ namespace boost{namespace icl
|
||||
// Unary predicates
|
||||
|
||||
template <class Type>
|
||||
class property : public std::unary_function<Type,bool>{};
|
||||
class property
|
||||
{
|
||||
public:
|
||||
typedef Type argument_type;
|
||||
typedef bool result_type;
|
||||
};
|
||||
|
||||
template <class Type>
|
||||
class member_property : public property<Type>
|
||||
@@ -35,7 +38,13 @@ namespace boost{namespace icl
|
||||
// Binary predicates: relations
|
||||
|
||||
template <class LeftT, class RightT>
|
||||
class relation : public std::binary_function<LeftT,RightT,bool>{};
|
||||
class relation
|
||||
{
|
||||
public:
|
||||
typedef LeftT first_argument_type;
|
||||
typedef RightT second_argument_type;
|
||||
typedef bool result_type;
|
||||
};
|
||||
|
||||
|
||||
}} // namespace icl boost
|
||||
|
||||
@@ -13,6 +13,7 @@ Copyright (c) 2008-2009: Joachim Faulhaber
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/icl/type_traits/no_type.hpp>
|
||||
|
||||
namespace boost{ namespace icl
|
||||
@@ -24,7 +25,7 @@ namespace boost{ namespace icl
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
template <class Type>
|
||||
struct has_rep_type
|
||||
struct has_rep_type
|
||||
: mpl::bool_<detail::has_rep<Type>::value>
|
||||
{};
|
||||
|
||||
@@ -33,14 +34,14 @@ namespace boost{ namespace icl
|
||||
: mpl::bool_<detail::has_rep<Type>::value>
|
||||
{
|
||||
typedef represents type;
|
||||
BOOST_STATIC_CONSTANT(bool,
|
||||
BOOST_STATIC_CONSTANT(bool,
|
||||
value = (mpl::and_< has_rep_type<Type>
|
||||
, is_same<typename Type::rep, Rep> >::value)
|
||||
, boost::is_same<typename Type::rep, Rep> >::value)
|
||||
);
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
template <class Type, bool has_rep>
|
||||
template <class Type, bool has_rep>
|
||||
struct get_rep_type;
|
||||
|
||||
template <class Type>
|
||||
@@ -56,15 +57,13 @@ namespace boost{ namespace icl
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
template<class Type>
|
||||
template<class Type>
|
||||
struct rep_type_of
|
||||
{
|
||||
typedef typename
|
||||
{
|
||||
typedef typename
|
||||
get_rep_type<Type, has_rep_type<Type>::value>::type type;
|
||||
};
|
||||
|
||||
}} // namespace boost icl
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -43,7 +43,6 @@ namespace boost{ namespace icl
|
||||
|
||||
template<>inline std::string type_to_string<float>::apply() { return "flt"; }
|
||||
template<>inline std::string type_to_string<double>::apply() { return "dbl"; }
|
||||
template<>inline std::string type_to_string<std::string>::apply() { return "string"; }
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
template<template<class> class Templ>
|
||||
@@ -78,6 +77,13 @@ namespace boost{ namespace icl
|
||||
}
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
template<>
|
||||
struct type_to_string<std::string>
|
||||
{
|
||||
static std::string apply() { return "string"; }
|
||||
};
|
||||
|
||||
}} // namespace boost icl
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,7 +11,7 @@ Copyright (c) 1999-2006: Cortex Software GmbH, Kantstrasse 57, Berlin
|
||||
#define BOOST_ICL_VALUE_SIZE_HPP_JOFA_081004
|
||||
|
||||
namespace boost{ namespace icl
|
||||
{
|
||||
{
|
||||
|
||||
template <typename Type>
|
||||
Type abs(Type val) { return val < 0 ? -val : val; }
|
||||
@@ -33,13 +33,13 @@ struct value_size
|
||||
};
|
||||
|
||||
|
||||
template<> inline std::size_t value_size<int>::apply(const int& value)
|
||||
template<> inline std::size_t value_size<int>::apply(const int& value)
|
||||
{ return abs(value); }
|
||||
|
||||
template<> inline std::size_t value_size<double>::apply(const double& value)
|
||||
template<> inline std::size_t value_size<double>::apply(const double& value)
|
||||
{ return static_cast<int>(abs(value)); }
|
||||
|
||||
template <typename Type>
|
||||
template <typename Type>
|
||||
inline std::size_t value_size<Type>::apply(const Type& value)
|
||||
{ return icl::iterative_size(value); }
|
||||
|
||||
@@ -48,5 +48,3 @@ inline std::size_t value_size<Type>::apply(const Type& value)
|
||||
}} // namespace boost icl
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user