|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r69545 - in sandbox/icl/boost/icl: . concept type_traits
From: afojgo_at_[hidden]
Date: 2011-03-04 06:57:34
Author: jofaber
Date: 2011-03-04 06:57:31 EST (Fri, 04 Mar 2011)
New Revision: 69545
URL: http://svn.boost.org/trac/boost/changeset/69545
Log:
Merged changes from trunk back to sandbox at 1.46.1/2
Properties modified:
sandbox/icl/boost/icl/ (props changed)
Text files modified:
sandbox/icl/boost/icl/associative_interval_container.hpp | 1
sandbox/icl/boost/icl/concept/interval.hpp | 80 +++++++++++++++++++++++++++++++++++++++
sandbox/icl/boost/icl/concept/interval_associator.hpp | 60 +-----------------------------
sandbox/icl/boost/icl/concept/interval_map.hpp | 17 +++-----
sandbox/icl/boost/icl/concept/interval_set.hpp | 5 +-
sandbox/icl/boost/icl/interval_base_map.hpp | 14 ++++---
sandbox/icl/boost/icl/interval_base_set.hpp | 12 +++--
sandbox/icl/boost/icl/rational.hpp | 2
sandbox/icl/boost/icl/type_traits/has_inverse.hpp | 2
sandbox/icl/boost/icl/type_traits/is_combinable.hpp | 10 ++--
sandbox/icl/boost/icl/type_traits/is_container.hpp | 4 +-
sandbox/icl/boost/icl/type_traits/is_key_container_of.hpp | 4 +-
12 files changed, 118 insertions(+), 93 deletions(-)
Modified: sandbox/icl/boost/icl/associative_interval_container.hpp
==============================================================================
--- sandbox/icl/boost/icl/associative_interval_container.hpp (original)
+++ sandbox/icl/boost/icl/associative_interval_container.hpp 2011-03-04 06:57:31 EST (Fri, 04 Mar 2011)
@@ -11,6 +11,7 @@
#include <boost/icl/concept/comparable.hpp>
#include <boost/icl/concept/joinable.hpp>
#include <boost/icl/concept/container.hpp>
+#include <boost/icl/concept/interval_associator_base.hpp>
#include <boost/icl/concept/interval_set.hpp>
#include <boost/icl/concept/interval_map.hpp>
#include <boost/icl/concept/interval_associator.hpp>
Modified: sandbox/icl/boost/icl/concept/interval.hpp
==============================================================================
--- sandbox/icl/boost/icl/concept/interval.hpp (original)
+++ sandbox/icl/boost/icl/concept/interval.hpp 2011-03-04 06:57:31 EST (Fri, 04 Mar 2011)
@@ -119,6 +119,85 @@
return dynamic_interval_traits<Type>::construct(value, value, interval_bounds::closed());
}
+namespace detail
+{
+
+//==============================================================================
+//= Construct<Interval> unit_trail == generalized singleton
+// 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
+// continuous types.
+//==============================================================================
+template<class Type>
+typename enable_if
+<
+ mpl::and_< is_static_right_open<Type>
+ , boost::detail::is_incrementable<typename interval_traits<Type>::domain_type> >
+ , Type
+>::type
+unit_trail(const typename interval_traits<Type>::domain_type& value)
+{
+ return interval_traits<Type>::construct(value, icl::succ(value));
+}
+
+template<class Type>
+typename enable_if
+<
+ mpl::and_< is_static_left_open<Type>
+ , boost::detail::is_incrementable<typename interval_traits<Type>::domain_type> >
+ , Type
+>::type
+unit_trail(const typename interval_traits<Type>::domain_type& value)
+{
+ typedef typename interval_traits<Type>::domain_type domain_type;
+ BOOST_ASSERT((numeric_minimum<domain_type, is_numeric<domain_type>::value >::is_less_than(value) ));
+
+ return interval_traits<Type>::construct(icl::pred(value), value);
+}
+
+template<class Type>
+typename enable_if
+<
+ mpl::and_< is_static_open<Type>
+ , is_discrete<typename interval_traits<Type>::domain_type> >
+ , Type
+>::type
+unit_trail(const typename interval_traits<Type>::domain_type& value)
+{
+ typedef typename interval_traits<Type>::domain_type domain_type;
+ BOOST_ASSERT((numeric_minimum<domain_type, is_numeric<domain_type>::value >::is_less_than(value)));
+
+ return interval_traits<Type>::construct(icl::pred(value), icl::succ(value));
+}
+
+template<class Type>
+typename enable_if
+<
+ mpl::and_< is_static_closed<Type>
+ , is_discrete<typename interval_traits<Type>::domain_type> >
+ , Type
+>::type
+unit_trail(const typename interval_traits<Type>::domain_type& value)
+{
+ return interval_traits<Type>::construct(value, value);
+}
+
+//NOTE: statically bounded closed or open intervals of continuous domain types
+// are NOT supported by ICL. They can not be used with interval containers
+// consistently.
+
+
+template<class Type>
+typename enable_if<has_dynamic_bounds<Type>, Type>::type
+unit_trail(const typename interval_traits<Type>::domain_type& value)
+{
+ return dynamic_interval_traits<Type>::construct(value, value, interval_bounds::closed());
+}
+
+} //namespace detail
+
//==============================================================================
//= Construct<Interval> multon
//==============================================================================
@@ -1341,7 +1420,6 @@
<< right_bracket<Type>(object) ;
}
-
}} // namespace icl boost
#endif
Modified: sandbox/icl/boost/icl/concept/interval_associator.hpp
==============================================================================
--- sandbox/icl/boost/icl/concept/interval_associator.hpp (original)
+++ sandbox/icl/boost/icl/concept/interval_associator.hpp 2011-03-04 06:57:31 EST (Fri, 04 Mar 2011)
@@ -202,7 +202,6 @@
return dist;
}
-
//==============================================================================
//= Range<IntervalSet|IntervalMap>
//==============================================================================
@@ -650,7 +649,7 @@
//------------------------------------------------------------------------------
template<class Type, class CoType>
typename enable_if<mpl::and_< is_interval_container<Type>
- , is_same<CoType, typename domain_type_of<Type>::type> >,
+ , boost::is_same<CoType, typename domain_type_of<Type>::type> >,
bool>::type
intersects(const Type& left, const CoType& right)
{
@@ -659,7 +658,7 @@
template<class Type, class CoType>
typename enable_if<mpl::and_< is_interval_container<Type>
- , is_same<CoType, typename interval_type_of<Type>::type> >,
+ , boost::is_same<CoType, typename interval_type_of<Type>::type> >,
bool>::type
intersects(const Type& left, const CoType& right)
{
@@ -725,16 +724,6 @@
return false;
}
-//CL?
-//template<class Type, class AssociateT>
-//typename enable_if<mpl::and_< is_interval_map<Type>
-// , is_inter_derivative<Type, AssociateT> >,
-// bool>::type
-//intersects(const Type& left, const AssociateT& right)
-//{
-// return icl::intersects(left, right);
-//}
-
/** \b Returns true, if \c left and \c right have no common elements.
Intervals are interpreted as sequence of elements.
\b Complexity: loglinear, if \c left and \c right are interval containers. */
@@ -902,51 +891,6 @@
return typename Type::element_const_reverse_iterator(object.rend());
}
-//==============================================================================
-//= Morphisms
-//==============================================================================
-template<class Type>
-typename enable_if<is_interval_container<Type>, Type>::type&
-join(Type& object)
-{
- typedef typename Type::interval_type interval_type;
- typedef typename Type::iterator iterator;
-
- iterator it_ = object.begin();
- if(it_ == object.end())
- return object;
-
- iterator next_ = it_; next_++;
-
- while(next_ != object.end())
- {
- if( segmental::is_joinable<Type>(it_, next_) )
- {
- iterator fst_mem = it_; // hold the first member
-
- // Go on while touching members are found
- it_++; next_++;
- while( next_ != object.end()
- && segmental::is_joinable<Type>(it_, next_) )
- { it_++; next_++; }
-
- // finally we arrive at the end of a sequence of joinable intervals
- // and it points to the last member of that sequence
- const_cast<interval_type&>(key_value<Type>(it_))
- = hull(key_value<Type>(it_), key_value<Type>(fst_mem));
- object.erase(fst_mem, it_);
-
- it_++; next_=it_;
- if(next_!=object.end())
- next_++;
- }
- else { it_++; next_++; }
- }
- return object;
-}
-
-
-
}} // namespace boost icl
#endif
Modified: sandbox/icl/boost/icl/concept/interval_map.hpp
==============================================================================
--- sandbox/icl/boost/icl/concept/interval_map.hpp (original)
+++ sandbox/icl/boost/icl/concept/interval_map.hpp 2011-03-04 06:57:31 EST (Fri, 04 Mar 2011)
@@ -22,11 +22,6 @@
namespace boost{ namespace icl
{
-template<class Type>
-typename enable_if<is_interval_container<Type>, Type>::type&
-join(Type&);
-
-
template<class Type>
inline typename enable_if<is_interval_map<Type>, typename Type::segment_type>::type
make_segment(const typename Type::element_type& element)
@@ -36,6 +31,7 @@
return segment_type(icl::singleton<interval_type>(element.key), element.data);
}
+
//==============================================================================
//= Containedness<IntervalMap>
//==============================================================================
@@ -47,7 +43,7 @@
contains(const Type& super, const typename Type::element_type& key_value_pair)
{
typedef typename Type::const_iterator const_iterator;
- const_iterator it_ = super.find(key_value_pair.key);
+ const_iterator it_ = icl::find(super, key_value_pair.key);
return it_ != super.end() && it_->second == key_value_pair.data;
}
@@ -433,7 +429,8 @@
template<class Type, class OperandT>
typename enable_if<mpl::and_< is_interval_map<Type>
, is_total<Type>
- , is_same<OperandT, typename segment_type_of<Type>::type> >,
+ , boost::is_same< OperandT
+ , typename segment_type_of<Type>::type> >,
bool>::type
intersects(const Type&, const OperandT&)
{
@@ -443,18 +440,18 @@
template<class Type, class OperandT>
typename enable_if<mpl::and_< is_interval_map<Type>
, mpl::not_<is_total<Type> >
- , is_same<OperandT, typename segment_type_of<Type>::type> >,
+ , boost::is_same<OperandT, typename segment_type_of<Type>::type> >,
bool>::type
intersects(const Type& object, const OperandT& operand)
{
Type intersection;
- icl::add_intersection(intersection, left, operand);
+ icl::add_intersection(intersection, object, operand);
return !icl::is_empty(intersection);
}
template<class Type, class OperandT>
typename enable_if<mpl::and_< is_interval_map<Type>
- , is_same<OperandT, typename element_type_of<Type>::type> >,
+ , boost::is_same<OperandT, typename element_type_of<Type>::type> >,
bool>::type
intersects(const Type& object, const OperandT& operand)
{
Modified: sandbox/icl/boost/icl/concept/interval_set.hpp
==============================================================================
--- sandbox/icl/boost/icl/concept/interval_set.hpp (original)
+++ sandbox/icl/boost/icl/concept/interval_set.hpp 2011-03-04 06:57:31 EST (Fri, 04 Mar 2011)
@@ -9,6 +9,7 @@
#define BOOST_ICL_CONCEPT_INTERVAL_SET_HPP_JOFA_100920
#include <boost/icl/type_traits/is_combinable.hpp>
+#include <boost/icl/type_traits/interval_type_of.hpp>
#include <boost/icl/detail/set_algo.hpp>
#include <boost/icl/detail/interval_set_algo.hpp>
#include <boost/icl/concept/interval.hpp>
@@ -26,7 +27,7 @@
typename enable_if<is_interval_set<Type>, bool>::type
contains(const Type& super, const typename Type::element_type& element)
{
- return !(super.find(element) == super.end());
+ return !(icl::find(super, element) == super.end());
}
template<class Type>
@@ -173,7 +174,7 @@
const typename Type::element_type& operand)
{
typedef typename Type::const_iterator const_iterator;
- const_iterator found = object.find(operand);
+ const_iterator found = icl::find(object, operand);
if(found != object.end())
icl::add(section, operand);
}
Modified: sandbox/icl/boost/icl/interval_base_map.hpp
==============================================================================
--- sandbox/icl/boost/icl/interval_base_map.hpp (original)
+++ sandbox/icl/boost/icl/interval_base_map.hpp 2011-03-04 06:57:31 EST (Fri, 04 Mar 2011)
@@ -253,20 +253,22 @@
//==========================================================================
/** Find the interval value pair, that contains \c key */
- const_iterator find(const domain_type& key)const
+ const_iterator find(const domain_type& key_value)const
{
- return _map.find(interval_type(key));
+ return icl::find(*this, key_value);
}
- const_iterator find(const interval_type& key)const
+ /** Find the first interval value pair, that collides with interval
+ \c key_interval */
+ const_iterator find(const interval_type& key_interval)const
{
- return _map.find(key);
+ return _map.find(key_interval);
}
/** Total select function. */
- codomain_type operator()(const domain_type& key)const
+ codomain_type operator()(const domain_type& key_value)const
{
- const_iterator it_ = _map.find(interval_type(key));
+ const_iterator it_ = icl::find(*this, key_value);
return it_==end() ? identity_element<codomain_type>::value()
: it_->second;
}
Modified: sandbox/icl/boost/icl/interval_base_set.hpp
==============================================================================
--- sandbox/icl/boost/icl/interval_base_set.hpp (original)
+++ sandbox/icl/boost/icl/interval_base_set.hpp 2011-03-04 06:57:31 EST (Fri, 04 Mar 2011)
@@ -201,15 +201,17 @@
//= Selection
//==========================================================================
- /** Find the interval value pair, that contains element \c key */
- const_iterator find(const element_type& key)const
+ /** Find the interval, that contains element \c key_value */
+ const_iterator find(const element_type& key_value)const
{
- return this->_set.find(icl::singleton<segment_type>(key));
+ return icl::find(*this, key_value);
+ //CL return this->_set.find(icl::singleton<segment_type>(key));
}
- const_iterator find(const segment_type& segment)const
+ /** Find the first interval, that collides with interval \c key_interval */
+ const_iterator find(const interval_type& key_interval)const
{
- return this->_set.find(segment);
+ return this->_set.find(key_interval);
}
//==========================================================================
Modified: sandbox/icl/boost/icl/rational.hpp
==============================================================================
--- sandbox/icl/boost/icl/rational.hpp (original)
+++ sandbox/icl/boost/icl/rational.hpp 2011-03-04 06:57:31 EST (Fri, 04 Mar 2011)
@@ -59,7 +59,7 @@
struct has_inverse<boost::rational<Integral> >
{
typedef has_inverse type;
- BOOST_STATIC_CONSTANT(bool, value = (is_signed<Integral>::value));
+ BOOST_STATIC_CONSTANT(bool, value = (boost::is_signed<Integral>::value));
};
}} // namespace icl boost
Modified: sandbox/icl/boost/icl/type_traits/has_inverse.hpp
==============================================================================
--- sandbox/icl/boost/icl/type_traits/has_inverse.hpp (original)
+++ sandbox/icl/boost/icl/type_traits/has_inverse.hpp 2011-03-04 06:57:31 EST (Fri, 04 Mar 2011)
@@ -18,7 +18,7 @@
{
typedef has_inverse<Type> type;
BOOST_STATIC_CONSTANT(bool,
- value = (type_traits::ice_or<is_signed<Type>::value,
+ value = (type_traits::ice_or<boost::is_signed<Type>::value,
is_floating_point<Type>::value>::value));
};
Modified: sandbox/icl/boost/icl/type_traits/is_combinable.hpp
==============================================================================
--- sandbox/icl/boost/icl/type_traits/is_combinable.hpp (original)
+++ sandbox/icl/boost/icl/type_traits/is_combinable.hpp 2011-03-04 06:57:31 EST (Fri, 04 Mar 2011)
@@ -25,7 +25,7 @@
{
typedef is_overloadable<Type> type;
BOOST_STATIC_CONSTANT(bool, value =
- (is_same<Type, typename Type::overloadable_type>::value)
+ (boost::is_same<Type, typename Type::overloadable_type>::value)
);
};
@@ -36,8 +36,8 @@
{
typedef is_codomain_equal<LeftT, RightT> type;
BOOST_STATIC_CONSTANT(bool, value =
- (is_same<typename LeftT::codomain_type,
- typename RightT::codomain_type>::value)
+ (boost::is_same<typename LeftT::codomain_type,
+ typename RightT::codomain_type>::value)
);
};
@@ -47,8 +47,8 @@
{
typedef is_key_compare_equal<LeftT, RightT> type;
BOOST_STATIC_CONSTANT(bool, value =
- (is_same<typename LeftT::key_compare,
- typename RightT::key_compare>::value)
+ (boost::is_same<typename LeftT::key_compare,
+ typename RightT::key_compare>::value)
);
};
Modified: sandbox/icl/boost/icl/type_traits/is_container.hpp
==============================================================================
--- sandbox/icl/boost/icl/type_traits/is_container.hpp (original)
+++ sandbox/icl/boost/icl/type_traits/is_container.hpp 2011-03-04 06:57:31 EST (Fri, 04 Mar 2011)
@@ -42,8 +42,8 @@
BOOST_STATIC_CONSTANT(bool,
value = (mpl::and_< is_container<Type>
, detail::has_key_type<Type>
- , is_same< typename key_type_of<Type>::type
- , typename value_type_of<Type>::type >
+ , boost::is_same< typename key_type_of<Type>::type
+ , typename value_type_of<Type>::type >
, mpl::not_<detail::has_segment_type<Type> >
>::value )
);
Modified: sandbox/icl/boost/icl/type_traits/is_key_container_of.hpp
==============================================================================
--- sandbox/icl/boost/icl/type_traits/is_key_container_of.hpp (original)
+++ sandbox/icl/boost/icl/type_traits/is_key_container_of.hpp 2011-03-04 06:57:31 EST (Fri, 04 Mar 2011)
@@ -64,7 +64,7 @@
typedef is_strict_key_container_of<KeyT, ObjectT> type;
BOOST_STATIC_CONSTANT(bool, value =
(mpl::and_< is_map<ObjectT>
- , is_same<KeyT, typename key_container_type_of<ObjectT>::type> >::value)
+ , boost::is_same<KeyT, typename key_container_type_of<ObjectT>::type> >::value)
);
};
@@ -75,7 +75,7 @@
BOOST_STATIC_CONSTANT(bool, value =
(mpl::or_< is_strict_key_container_of<KeyT, ObjectT>
, mpl::and_< mpl::or_<is_set<ObjectT>, is_map<ObjectT> >
- , is_same<ObjectT, KeyT> > >::value)
+ , boost::is_same<ObjectT, KeyT> > >::value)
);
};
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk