|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r50095 - in sandbox/itl: boost/itl boost/itl_xt libs/itl/example/boost_party libs/itl/test
From: afojgo_at_[hidden]
Date: 2008-12-03 15:31:25
Author: jofaber
Date: 2008-12-03 15:31:23 EST (Wed, 03 Dec 2008)
New Revision: 50095
URL: http://svn.boost.org/trac/boost/changeset/50095
Log:
Refactored: Compare functor refactoring complete. Compare has to be ttp. Stable {msvc-9.0}
Text files modified:
sandbox/itl/boost/itl/functors.hpp | 4
sandbox/itl/boost/itl/interval.hpp | 88 +++++++++---------
sandbox/itl/boost/itl/interval_base_map.hpp | 11 +-
sandbox/itl/boost/itl/interval_base_set.hpp | 6
sandbox/itl/boost/itl/interval_map.hpp | 4
sandbox/itl/boost/itl/interval_set.hpp | 6
sandbox/itl/boost/itl/map.hpp | 180 ++++++++++++++++++++--------------------
sandbox/itl/boost/itl/notate.hpp | 28 ++++--
sandbox/itl/boost/itl/separate_interval_set.hpp | 6
sandbox/itl/boost/itl/set.hpp | 102 +++++++++++-----------
sandbox/itl/boost/itl/split_interval_map.hpp | 4
sandbox/itl/boost/itl/split_interval_set.hpp | 11 +-
sandbox/itl/boost/itl_xt/episode_set.hpp | 12 ++
sandbox/itl/libs/itl/example/boost_party/boost_party.cpp | 2
sandbox/itl/libs/itl/test/test_interval_map_shared.hpp | 44 ++++----
sandbox/itl/libs/itl/test/test_interval_set_shared.hpp | 54 ++++++------
16 files changed, 291 insertions(+), 271 deletions(-)
Modified: sandbox/itl/boost/itl/functors.hpp
==============================================================================
--- sandbox/itl/boost/itl/functors.hpp (original)
+++ sandbox/itl/boost/itl/functors.hpp 2008-12-03 15:31:23 EST (Wed, 03 Dec 2008)
@@ -158,7 +158,7 @@
//--------------------------------------------------------------------------
// Inverse functor
-#ifdef ITL_USE_COMBINE_TEMPLATE
+#ifdef ITL_USE_COMBINE_TEMPLATE_TEMPLATE
template<template<class>class Functor, class Type> struct inverse;
template<class Type>
@@ -185,7 +185,7 @@
struct inverse<itl::inplace_min, Type>
{ typedef itl::inplace_max<Type> type; };
-#else //ITL_USE_COMBINE_TYPE
+#else //ITL_USE_COMBINE_TEMPLATE_TYPE
template<class Functor, class Type> struct inverse;
template<class Type>
Modified: sandbox/itl/boost/itl/interval.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval.hpp (original)
+++ sandbox/itl/boost/itl/interval.hpp 2008-12-03 15:31:23 EST (Wed, 03 Dec 2008)
@@ -300,7 +300,7 @@
@author Joachim Faulhaber
*/
-template <class DomainT, ITL_COMPARE Compare = std::less>
+template <class DomainT, ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, DomainT)>
class interval
{
public:
@@ -311,7 +311,7 @@
/// Domain type or element type
typedef DomainT domain_type;
/// Compare order on the data
- typedef Compare<DomainT> domain_compare;
+ typedef ITL_COMPARE_DOMAIN(Compare,DomainT) domain_compare;
/// The difference type of an interval which is sometimes different form the domain_type
typedef typename itl::difference<DomainT>::type difference_type;
@@ -511,7 +511,7 @@
{
if(empty())
return itl::neutron<size_type>::value();
- else if(is_closed() && data_equal(_lwb, _upb))
+ else if(is_closed() && domain_equal(_lwb, _upb))
return itl::unon<size_type>::value();
else
return std::numeric_limits<size_type>::infinity();
@@ -577,13 +577,13 @@
public:
typedef typename boost::call_traits<DomainT>::param_type DomainP;
- inline static bool data_less(DomainP left, DomainP right)
+ inline static bool domain_less(DomainP left, DomainP right)
{return domain_compare()(left, right) ;}
- inline static bool data_less_equal(DomainP left, DomainP right)
+ inline static bool domain_less_equal(DomainP left, DomainP right)
{return !domain_compare()(right, left );}
- inline static bool data_equal(DomainP left, DomainP right)
+ inline static bool domain_equal(DomainP left, DomainP right)
{return !domain_compare()(left, right) && !domain_compare()(right, left);}
private:
@@ -636,9 +636,9 @@
typedef typename boost::call_traits<domain_type>::param_type DomainP;
static bool open_bound_less_equal(DomainP x, DomainP y)
- { return IntervalT::data_less_equal(x,y); } //{ return x <= y; }
+ { return IntervalT::domain_less_equal(x,y); } //{ return x <= y; }
static bool open_bound_less (DomainP x, DomainP y)
- { return IntervalT::data_less(x,y); } //{ return x < y; }
+ { return IntervalT::domain_less(x,y); } //{ return x < y; }
};
template<class IntervalT>
@@ -648,9 +648,9 @@
typedef typename boost::call_traits<domain_type>::param_type DomainP;
static bool open_bound_less_equal(DomainP x, DomainP y)
- { return IntervalT::data_less_equal(x, succ(y)); } //{ return x <= succ(y); }
+ { return IntervalT::domain_less_equal(x, succ(y)); } //{ return x <= succ(y); }
static bool open_bound_less (DomainP x, DomainP y)
- { return IntervalT::data_less(succ(x),y); } //{ return succ(x) < y ; }
+ { return IntervalT::domain_less(succ(x),y); } //{ return succ(x) < y ; }
};
template <class DomainT, ITL_COMPARE Compare>
@@ -658,9 +658,9 @@
{
using namespace boost::mpl;
- if(rightbound_closed() && leftbound_closed()) return data_less(_upb, _lwb); //_upb < _lwb;
- if(rightbound_open() && leftbound_closed()) return data_less_equal(_upb, _lwb); //_upb <= _lwb;
- if(rightbound_closed() && leftbound_open()) return data_less_equal(_upb, _lwb); //_upb <= _lwb;
+ if(rightbound_closed() && leftbound_closed()) return domain_less(_upb, _lwb); //_upb < _lwb;
+ if(rightbound_open() && leftbound_closed()) return domain_less_equal(_upb, _lwb); //_upb <= _lwb;
+ if(rightbound_closed() && leftbound_open()) return domain_less_equal(_upb, _lwb); //_upb <= _lwb;
// OTHERWISE (rightbound_open() && leftbound_open())
return
@@ -709,23 +709,23 @@
static bool unaligned_lwb_equal(const IntervalT& x1, const IntervalT& x2)
{
if(x1.leftbound_open() && x2.leftbound_closed())
- return IntervalT::data_equal(succ(x1.lower()), x2.lower() );
- else return IntervalT::data_equal( x1.lower(), succ(x2.lower()));
+ return IntervalT::domain_equal(succ(x1.lower()), x2.lower() );
+ else return IntervalT::domain_equal( x1.lower(), succ(x2.lower()));
}
static bool unaligned_upb_equal(const IntervalT& x1, const IntervalT& x2)
{
if(x1.rightbound_closed() && x2.rightbound_open())
- return IntervalT::data_equal(succ(x1.upper()), x2.upper() );
- else return IntervalT::data_equal( x1.upper(), succ(x2.upper()));
+ return IntervalT::domain_equal(succ(x1.upper()), x2.upper() );
+ else return IntervalT::domain_equal( x1.upper(), succ(x2.upper()));
}
static bool has_equal_border_touch(const IntervalT& x1, const IntervalT& x2)
{
if(x1.rightbound_closed() && x2.leftbound_closed())
- return IntervalT::data_equal(succ(x1.upper()), x2.lower());
+ return IntervalT::domain_equal(succ(x1.upper()), x2.lower());
if(x1.rightbound_open() && x2.leftbound_open() )
- return IntervalT::data_equal(x1.upper(), succ(x2.lower()));
+ return IntervalT::domain_equal(x1.upper(), succ(x2.lower()));
return false;
}
@@ -737,9 +737,9 @@
bool interval<DomainT,Compare>::exclusive_less(const interval& x2)const
{
using namespace boost::mpl;
- if(rightbound_closed() && x2.leftbound_closed()) return data_less(_upb, x2._lwb); //_upb < x2._lwb
- if(rightbound_open() && x2.leftbound_closed()) return data_less_equal(_upb, x2._lwb); //_upb <= x2._lwb;
- if(rightbound_closed() && x2.leftbound_open() ) return data_less_equal(_upb, x2._lwb); //_upb <= x2._lwb;
+ if(rightbound_closed() && x2.leftbound_closed()) return domain_less(_upb, x2._lwb); //_upb < x2._lwb
+ if(rightbound_open() && x2.leftbound_closed()) return domain_less_equal(_upb, x2._lwb); //_upb <= x2._lwb;
+ if(rightbound_closed() && x2.leftbound_open() ) return domain_less_equal(_upb, x2._lwb); //_upb <= x2._lwb;
return
if_<
@@ -755,9 +755,9 @@
bool interval<DomainT,Compare>::lower_less(const interval& x2)const
{
using namespace boost::mpl;
- if(leftbound_closed() && x2.leftbound_closed()) return data_less(_lwb, x2._lwb);
- if(leftbound_open() && x2.leftbound_open()) return data_less(_lwb, x2._lwb);
- if(leftbound_closed() && x2.leftbound_open()) return data_less_equal(_lwb, x2._lwb);//data_less_equal(_lwb, x2._lwb);
+ if(leftbound_closed() && x2.leftbound_closed()) return domain_less(_lwb, x2._lwb);
+ if(leftbound_open() && x2.leftbound_open()) return domain_less(_lwb, x2._lwb);
+ if(leftbound_closed() && x2.leftbound_open()) return domain_less_equal(_lwb, x2._lwb);//domain_less_equal(_lwb, x2._lwb);
// OTHERWISE (leftbound_open() && x2.leftbound_closed())
return
@@ -773,9 +773,9 @@
bool interval<DomainT,Compare>::upper_less(const interval& x2)const
{
using namespace boost::mpl;
- if(rightbound_closed() && x2.rightbound_closed()) return data_less(_upb, x2._upb);
- if(rightbound_open() && x2.rightbound_open()) return data_less(_upb, x2._upb);
- if(rightbound_open() && x2.rightbound_closed()) return data_less_equal(_upb, x2._upb);//data_less_equal(_upb, x2._upb);
+ if(rightbound_closed() && x2.rightbound_closed()) return domain_less(_upb, x2._upb);
+ if(rightbound_open() && x2.rightbound_open()) return domain_less(_upb, x2._upb);
+ if(rightbound_open() && x2.rightbound_closed()) return domain_less_equal(_upb, x2._upb);//domain_less_equal(_upb, x2._upb);
// OTHERWISE (rightbound_closed() && x2.rightbound_open())
return
@@ -792,9 +792,9 @@
bool interval<DomainT,Compare>::lower_less_equal(const interval& x2)const
{
using namespace boost::mpl;
- if(leftbound_closed() && x2.leftbound_closed()) return data_less_equal(_lwb, x2._lwb);
- if(leftbound_open() && x2.leftbound_open()) return data_less_equal(_lwb, x2._lwb);
- if(leftbound_open() && x2.leftbound_closed()) return data_less(_lwb, x2._lwb);
+ if(leftbound_closed() && x2.leftbound_closed()) return domain_less_equal(_lwb, x2._lwb);
+ if(leftbound_open() && x2.leftbound_open()) return domain_less_equal(_lwb, x2._lwb);
+ if(leftbound_open() && x2.leftbound_closed()) return domain_less(_lwb, x2._lwb);
// OTHERWISE (leftbound_closed() && x2.leftbound_open())
return
@@ -811,9 +811,9 @@
bool interval<DomainT,Compare>::upper_less_equal(const interval& x2)const
{
using namespace boost::mpl;
- if(rightbound_closed() && x2.rightbound_closed()) return data_less_equal(_upb, x2._upb);
- if(rightbound_open() && x2.rightbound_open()) return data_less_equal(_upb, x2._upb);
- if(rightbound_closed() && x2.rightbound_open()) return data_less(_upb, x2._upb);
+ if(rightbound_closed() && x2.rightbound_closed()) return domain_less_equal(_upb, x2._upb);
+ if(rightbound_open() && x2.rightbound_open()) return domain_less_equal(_upb, x2._upb);
+ if(rightbound_closed() && x2.rightbound_open()) return domain_less(_upb, x2._upb);
// OTHERWISE (rightbound_open() && x2.rightbound_closed())
return
@@ -832,8 +832,8 @@
bool interval<DomainT,Compare>::lower_equal(const interval& x2)const
{
using namespace boost::mpl;
- if(leftbound_closed() && x2.leftbound_closed()) return data_equal(_lwb, x2._lwb);
- if(leftbound_open() && x2.leftbound_open() ) return data_equal(_lwb, x2._lwb);
+ if(leftbound_closed() && x2.leftbound_closed()) return domain_equal(_lwb, x2._lwb);
+ if(leftbound_open() && x2.leftbound_open() ) return domain_equal(_lwb, x2._lwb);
return
if_<
@@ -850,8 +850,8 @@
bool interval<DomainT,Compare>::upper_equal(const interval& x2)const
{
using namespace boost::mpl;
- if(rightbound_closed() && x2.rightbound_closed()) return data_equal(_upb, x2._upb);
- if(rightbound_open() && x2.rightbound_open() ) return data_equal(_upb, x2._upb);
+ if(rightbound_closed() && x2.rightbound_closed()) return domain_equal(_upb, x2._upb);
+ if(rightbound_open() && x2.rightbound_open() ) return domain_equal(_upb, x2._upb);
return
if_<
@@ -921,8 +921,8 @@
bool interval<DomainT,Compare>::touches(const interval& x2)const
{
using namespace boost::mpl;
- if(rightbound_open() && x2.leftbound_closed()) return data_equal(_upb, x2._lwb);
- if(rightbound_closed() && x2.leftbound_open()) return data_equal(_upb, x2._lwb);
+ if(rightbound_open() && x2.leftbound_closed()) return domain_equal(_upb, x2._lwb);
+ if(rightbound_closed() && x2.leftbound_open()) return domain_equal(_upb, x2._lwb);
return
if_<
@@ -936,10 +936,10 @@
template <class DomainT, ITL_COMPARE Compare>
bool interval<DomainT,Compare>::contains(const DomainT& x)const
{
- if(rightbound_closed() && leftbound_closed()) return data_less_equal(_lwb, x) && data_less_equal(x, _upb);
- if(rightbound_closed() && leftbound_open() ) return data_less(_lwb, x) && data_less_equal(x, _upb);
- if(rightbound_open() && leftbound_closed()) return data_less_equal(_lwb, x) && data_less(x, _upb);
- return data_less(_lwb, x) && data_less(x, _upb);
+ if(rightbound_closed() && leftbound_closed()) return domain_less_equal(_lwb, x) && domain_less_equal(x, _upb);
+ if(rightbound_closed() && leftbound_open() ) return domain_less(_lwb, x) && domain_less_equal(x, _upb);
+ if(rightbound_open() && leftbound_closed()) return domain_less_equal(_lwb, x) && domain_less(x, _upb);
+ return domain_less(_lwb, x) && domain_less(x, _upb);
}
template <class DomainT, ITL_COMPARE Compare>
Modified: sandbox/itl/boost/itl/interval_base_map.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_base_map.hpp (original)
+++ sandbox/itl/boost/itl/interval_base_map.hpp 2008-12-03 15:31:23 EST (Wed, 03 Dec 2008)
@@ -136,8 +136,8 @@
typename CodomainT,
class Traits = itl::neutron_absorber,
template<class,ITL_COMPARE>class Interval = itl::interval,
- ITL_COMPARE Compare = std::less,
- ITL_COMBINE Combine = ITL_INPLACE_PLUS(CodomainT),
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, DomainT),
+ ITL_COMBINE Combine = ITL_COMBINE_INSTANCE(itl::inplace_plus, CodomainT),
ITL_ALLOC Alloc = std::allocator
>
#ifdef USE_CONCEPTS
@@ -184,9 +184,8 @@
typedef typename interval_type::size_type size_type;
/// Comparison functor for domain values
- typedef Compare<DomainT> domain_compare;
+ typedef ITL_COMPARE_DOMAIN(Compare,DomainT) domain_compare;
/// Combine functor for codomain values
- //typedef Combine<CodomainT> codomain_combine;
typedef ITL_COMBINE_CODOMAIN(Combine,CodomainT) codomain_combine;
/// Comparison functor for intervals which are keys as well
typedef exclusive_less<interval_type> interval_compare;
@@ -200,7 +199,7 @@
/// Container type for the implementation
typedef itl::map<interval_type,codomain_type,Traits,
- exclusive_less,Combine,Alloc> ImplMapT;
+ ITL_EXCLUSIVE_LESS(interval_type),Combine,Alloc> ImplMapT;
/// key type of the implementing container
typedef typename ImplMapT::key_type key_type;
@@ -1233,7 +1232,7 @@
{
return std::lexicographical_compare(
lhs.begin(), lhs.end(), rhs.begin(), rhs.end(),
- Compare<std::pair<Interval<DomainT,Compare>, CodomainT> >()
+ Compare<std::pair<Interval<DomainT,Compare>, CodomainT> >() //NOTE DESIGN TTP: Why template template parameter Compare is needed
);
}
Modified: sandbox/itl/boost/itl/interval_base_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_base_set.hpp (original)
+++ sandbox/itl/boost/itl/interval_base_set.hpp 2008-12-03 15:31:23 EST (Wed, 03 Dec 2008)
@@ -103,7 +103,7 @@
typename SubType,
typename DomainT,
template<class, ITL_COMPARE>class Interval = itl::interval,
- ITL_COMPARE Compare = std::less,
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, DomainT),
ITL_ALLOC Alloc = std::allocator
>
#ifdef USE_CONCEPTS
@@ -135,7 +135,7 @@
/// Comparison functor for domain values
- typedef Compare<DomainT> domain_compare;
+ typedef ITL_COMPARE_DOMAIN(Compare,DomainT) domain_compare;
/// Comparison functor for intervals
typedef exclusive_less<interval_type> interval_compare;
@@ -155,7 +155,7 @@
typedef typename itl::set<DomainT,Compare,Alloc> atomized_type;
/// Container type for the implementation
- typedef typename itl::set<interval_type,exclusive_less,Alloc> ImplSetT;
+ typedef typename itl::set<interval_type,ITL_EXCLUSIVE_LESS(interval_type),Alloc> ImplSetT;
/// key type of the implementing container
typedef typename ImplSetT::key_type key_type;
Modified: sandbox/itl/boost/itl/interval_map.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_map.hpp (original)
+++ sandbox/itl/boost/itl/interval_map.hpp 2008-12-03 15:31:23 EST (Wed, 03 Dec 2008)
@@ -108,8 +108,8 @@
typename CodomainT,
class Traits = itl::neutron_absorber,
template<class,ITL_COMPARE>class Interval = itl::interval,
- ITL_COMPARE Compare = std::less,
- ITL_COMBINE Combine = ITL_INPLACE_PLUS(CodomainT),
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, DomainT),
+ ITL_COMBINE Combine = ITL_COMBINE_INSTANCE(itl::inplace_plus, CodomainT),
ITL_ALLOC Alloc = std::allocator
>
class interval_map:
Modified: sandbox/itl/boost/itl/interval_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_set.hpp (original)
+++ sandbox/itl/boost/itl/interval_set.hpp 2008-12-03 15:31:23 EST (Wed, 03 Dec 2008)
@@ -105,7 +105,7 @@
typename DomainT,
template<class,ITL_COMPARE>class
Interval = itl::interval,
- ITL_COMPARE Compare = std::less,
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, DomainT),
ITL_ALLOC Alloc = std::allocator
>
class interval_set:
@@ -130,7 +130,7 @@
typedef Interval<DomainT,Compare> interval_type;
/// Comparison functor for domain values
- typedef Compare<DomainT> domain_compare;
+ typedef ITL_COMPARE_DOMAIN(Compare,DomainT) domain_compare;
/// Comparison functor for intervals
typedef exclusive_less<interval_type> interval_compare;
@@ -150,7 +150,7 @@
typedef typename itl::set<DomainT,Compare,Alloc> atomized_type;
/// Container type for the implementation
- typedef typename itl::set<interval_type,exclusive_less,Alloc> ImplSetT;
+ typedef typename itl::set<interval_type,ITL_EXCLUSIVE_LESS(interval_type),Alloc> ImplSetT;
/// key type of the implementing container
typedef typename ImplSetT::key_type key_type;
Modified: sandbox/itl/boost/itl/map.hpp
==============================================================================
--- sandbox/itl/boost/itl/map.hpp (original)
+++ sandbox/itl/boost/itl/map.hpp 2008-12-03 15:31:23 EST (Wed, 03 Dec 2008)
@@ -100,39 +100,39 @@
*/
template
<
- typename KeyT,
- typename DataT,
+ typename DomainT,
+ typename CodomainT,
class Traits = itl::neutron_absorber,
- ITL_COMPARE Compare = std::less,
- ITL_COMBINE Combine = ITL_INPLACE_PLUS(DataT),
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, DomainT),
+ ITL_COMBINE Combine = ITL_COMBINE_INSTANCE(itl::inplace_plus, CodomainT),
ITL_ALLOC Alloc = std::allocator
>
- class map: private std::map<KeyT, DataT, Compare<KeyT>,
- Alloc<std::pair<const KeyT, DataT> > >
+ class map: private std::map<DomainT, CodomainT, ITL_COMPARE_DOMAIN(Compare,DomainT),
+ Alloc<std::pair<const DomainT, CodomainT> > >
{
public:
- typedef Alloc<typename std::pair<const KeyT, DataT> > allocator_type;
+ typedef Alloc<typename std::pair<const DomainT, CodomainT> > allocator_type;
- typedef typename itl::map<KeyT,DataT,Traits, Compare,Combine,Alloc> type;
- typedef typename std::map<KeyT, DataT, Compare<KeyT>,
+ typedef typename itl::map<DomainT,CodomainT,Traits, Compare,Combine,Alloc> type;
+ typedef typename std::map<DomainT, CodomainT, ITL_COMPARE_DOMAIN(Compare,DomainT),
allocator_type> base_type;
- typedef typename itl::set<KeyT, Compare, Alloc > set_type;
+ typedef typename itl::set<DomainT, Compare, Alloc > set_type;
- typedef itl::map<KeyT,DataT,itl::neutron_absorber,Compare,Combine,Alloc>
+ typedef itl::map<DomainT,CodomainT,itl::neutron_absorber,Compare,Combine,Alloc>
neutron_absorber_type;
typedef Traits traits;
public:
- typedef KeyT key_type;
- typedef KeyT domain_type;
- typedef DataT mapped_type;
- typedef DataT data_type;
- typedef DataT codomain_type;
- typedef std::pair<const KeyT, DataT> value_type;
- typedef Compare<KeyT> key_compare;
- typedef ITL_COMBINE_CODOMAIN(Combine,DataT) data_combine;
- typedef typename inverse<Combine,DataT>::type inverse_data_combine;
- typedef inplace_star<DataT> data_intersect;
+ typedef DomainT domain_type;
+ typedef DomainT key_type;
+ typedef CodomainT codomain_type;
+ typedef CodomainT mapped_type;
+ typedef CodomainT data_type;
+ typedef std::pair<const DomainT, CodomainT> value_type;
+ typedef ITL_COMPARE_DOMAIN(Compare,DomainT) key_compare;
+ typedef ITL_COMBINE_CODOMAIN(Combine,CodomainT) data_combine;
+ typedef typename inverse<Combine,CodomainT>::type inverse_data_combine;
+ typedef inplace_star<CodomainT> data_intersect;
typedef typename base_type::value_compare value_compare;
public:
@@ -196,7 +196,7 @@
//JODO concept set
/** Checks if a key element is in the map */
- bool contains(const KeyT& x)const { return !(find(x) == end()); }
+ bool contains(const DomainT& x)const { return !(find(x) == end()); }
/** Is <tt>*this</tt> contained in <tt>super</tt>? */
bool contained_in(const map& super)const
@@ -208,7 +208,7 @@
std::pair<iterator,bool> insert(const value_type& value_pair)
{
- if(Traits::absorbs_neutrons && value_pair.CONT_VALUE == DataT())
+ if(Traits::absorbs_neutrons && value_pair.CONT_VALUE == CodomainT())
return std::pair<iterator,bool>(end(),true);
else
return base_type::insert(value_pair);
@@ -316,68 +316,68 @@
/** Standard equality, which is lexicographical equality of the sets
as sequences, that are given by their Compare order. */
- template <typename KeyT, typename DataT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
- inline bool operator == (const itl::map<KeyT,DataT,Traits,Compare,Combine,Alloc>& lhs,
- const itl::map<KeyT,DataT,Traits,Compare,Combine,Alloc>& rhs)
+ template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
+ inline bool operator == (const itl::map<DomainT,CodomainT,Traits,Compare,Combine,Alloc>& lhs,
+ const itl::map<DomainT,CodomainT,Traits,Compare,Combine,Alloc>& rhs)
{
- typedef std::map<KeyT,DataT,Compare<KeyT>,Alloc<KeyT> > base_type;
+ typedef std::map<DomainT,CodomainT,ITL_COMPARE_DOMAIN(Compare,DomainT),Alloc<DomainT> > base_type;
return operator==((const base_type&)lhs, (const base_type&)rhs);
}
//JODO comment...
- template <typename KeyT, typename DataT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
- inline bool is_element_equal(const itl::map<KeyT,DataT,Traits,Compare,Combine,Alloc>& lhs,
- const itl::map<KeyT,DataT,Traits,Compare,Combine,Alloc>& rhs)
+ template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
+ inline bool is_element_equal(const itl::map<DomainT,CodomainT,Traits,Compare,Combine,Alloc>& lhs,
+ const itl::map<DomainT,CodomainT,Traits,Compare,Combine,Alloc>& rhs)
{
- typedef std::map<KeyT,DataT,Compare<KeyT>,Alloc<KeyT> > base_type;
+ typedef std::map<DomainT,CodomainT,ITL_COMPARE_DOMAIN(Compare,DomainT),Alloc<DomainT> > base_type;
return operator==((const base_type&)lhs, (const base_type&)rhs);
}
/** Protonic equality is equality on all elements that do not carry a neutron as content. */
- template <typename KeyT, typename DataT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
- inline bool is_protonic_equal (const itl::map<KeyT,DataT,Traits,Compare,Combine,Alloc>& lhs,
- const itl::map<KeyT,DataT,Traits,Compare,Combine,Alloc>& rhs)
+ template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
+ inline bool is_protonic_equal (const itl::map<DomainT,CodomainT,Traits,Compare,Combine,Alloc>& lhs,
+ const itl::map<DomainT,CodomainT,Traits,Compare,Combine,Alloc>& rhs)
{
//JODO: Efficient implementation.
- typedef std::map<KeyT,DataT,Compare<KeyT>,Alloc<KeyT> > base_type;
+ typedef std::map<DomainT,CodomainT,ITL_COMPARE_DOMAIN(Compare,DomainT),Alloc<DomainT> > base_type;
- itl::map<KeyT,DataT,Traits,Compare,Combine,Alloc> lhs0 = lhs;
- itl::map<KeyT,DataT,Traits,Compare,Combine,Alloc> rhs0 = rhs;
+ itl::map<DomainT,CodomainT,Traits,Compare,Combine,Alloc> lhs0 = lhs;
+ itl::map<DomainT,CodomainT,Traits,Compare,Combine,Alloc> rhs0 = rhs;
lhs0.absorb_neutrons();
rhs0.absorb_neutrons();
return operator==((const base_type&)lhs0, (const base_type&)rhs0);
}
/** Strict weak less ordering which is given by the Compare order */
- template <typename KeyT, typename DataT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
- inline bool operator < (const itl::map<KeyT,DataT,Traits,Compare,Combine,Alloc>& lhs,
- const itl::map<KeyT,DataT,Traits,Compare,Combine,Alloc>& rhs)
+ template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
+ inline bool operator < (const itl::map<DomainT,CodomainT,Traits,Compare,Combine,Alloc>& lhs,
+ const itl::map<DomainT,CodomainT,Traits,Compare,Combine,Alloc>& rhs)
{
- typedef std::map<KeyT,DataT,Compare<KeyT>,Alloc<KeyT> > base_type;
+ typedef std::map<DomainT,CodomainT,ITL_COMPARE_DOMAIN(Compare,DomainT),Alloc<DomainT> > base_type;
return operator<((const base_type&)lhs, (const base_type&)rhs);
}
/** Partial ordering which is induced by Compare */
- template <typename KeyT, typename DataT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
- inline bool operator <= (const itl::map<KeyT,DataT,Traits,Compare,Combine,Alloc>& lhs,
- const itl::map<KeyT,DataT,Traits,Compare,Combine,Alloc>& rhs)
+ template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
+ inline bool operator <= (const itl::map<DomainT,CodomainT,Traits,Compare,Combine,Alloc>& lhs,
+ const itl::map<DomainT,CodomainT,Traits,Compare,Combine,Alloc>& rhs)
{
- typedef std::map<KeyT,DataT,Compare<KeyT>,Alloc<KeyT> > base_type;
+ typedef std::map<DomainT,CodomainT,ITL_COMPARE_DOMAIN(Compare,DomainT),Alloc<DomainT> > base_type;
return operator<=((const base_type&)lhs, (const base_type&)rhs);
}
- template <typename KeyT, typename DataT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
+ template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
template <class Combiner>
- typename map<KeyT,DataT,Traits,Compare,Combine,Alloc>::iterator
- map<KeyT,DataT,Traits,Compare,Combine,Alloc>::add(const value_type& val)
+ typename map<DomainT,CodomainT,Traits,Compare,Combine,Alloc>::iterator
+ map<DomainT,CodomainT,Traits,Compare,Combine,Alloc>::add(const value_type& val)
{
- if(Traits::absorbs_neutrons && val.CONT_VALUE == DataT())
+ if(Traits::absorbs_neutrons && val.CONT_VALUE == CodomainT())
return end();
std::pair<iterator, bool> insertion;
if(Traits::emits_neutrons)
{
- DataT added_val = DataT();
+ CodomainT added_val = CodomainT();
Combiner()(added_val, val.CONT_VALUE);
insertion = insert(value_type(val.KEY_VALUE, added_val));
}
@@ -391,7 +391,7 @@
iterator it = insertion.ITERATOR;
Combiner()((*it).CONT_VALUE, val.CONT_VALUE);
- if(Traits::absorbs_neutrons && (*it).CONT_VALUE == DataT())
+ if(Traits::absorbs_neutrons && (*it).CONT_VALUE == CodomainT())
{
erase(it);
return end();
@@ -401,12 +401,12 @@
}
}
- template <typename KeyT, typename DataT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
- typename map<KeyT,DataT,Traits,Compare,Combine,Alloc>::size_type
- map<KeyT,DataT,Traits,Compare,Combine,Alloc>
+ template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
+ typename map<DomainT,CodomainT,Traits,Compare,Combine,Alloc>::size_type
+ map<DomainT,CodomainT,Traits,Compare,Combine,Alloc>
::erase(const value_type& value_pair)
{
- if(Traits::absorbs_neutrons && value_pair.CONT_VALUE == DataT())
+ if(Traits::absorbs_neutrons && value_pair.CONT_VALUE == CodomainT())
return 0; // neutrons are never contained 'substantially'
// only 'virually'.
@@ -421,9 +421,9 @@
}
- template <typename KeyT, typename DataT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
- typename map<KeyT,DataT,Traits,Compare,Combine,Alloc>::iterator
- map<KeyT,DataT,Traits,Compare,Combine,Alloc>::subtract(const value_type& val)
+ template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
+ typename map<DomainT,CodomainT,Traits,Compare,Combine,Alloc>::iterator
+ map<DomainT,CodomainT,Traits,Compare,Combine,Alloc>::subtract(const value_type& val)
{
if(Traits::emits_neutrons)
return add<inverse_data_combine>(val);
@@ -434,7 +434,7 @@
{
(*it_).CONT_VALUE -= val.CONT_VALUE;
- if(Traits::absorbs_neutrons && (*it_).CONT_VALUE == DataT())
+ if(Traits::absorbs_neutrons && (*it_).CONT_VALUE == CodomainT())
{
erase(it_);
return end();
@@ -447,15 +447,15 @@
}
- template <typename KeyT, typename DataT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
- std::string map<KeyT,DataT,Traits,Compare,Combine,Alloc>::as_string()const
+ template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
+ std::string map<DomainT,CodomainT,Traits,Compare,Combine,Alloc>::as_string()const
{
std::string repr;
const_FORALL_THIS(it) {
std::string elem("(");
- elem += to_string<KeyT>::apply((*it).KEY_VALUE);
+ elem += to_string<DomainT>::apply((*it).KEY_VALUE);
elem += "->";
- elem += to_string<DataT>::apply((*it).CONT_VALUE);
+ elem += to_string<CodomainT>::apply((*it).CONT_VALUE);
elem += ")";
repr += elem;
@@ -463,9 +463,9 @@
return repr;
}
- template <typename KeyT, typename DataT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
+ template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
template<class Predicate>
- map<KeyT,DataT,Traits,Compare,Combine,Alloc>& map<KeyT,DataT,Traits,Compare,Combine,Alloc>
+ map<DomainT,CodomainT,Traits,Compare,Combine,Alloc>& map<DomainT,CodomainT,Traits,Compare,Combine,Alloc>
::erase_if(const Predicate& pred)
{
iterator it = begin();
@@ -477,10 +477,10 @@
}
- template <typename KeyT, typename DataT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
+ template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
template<class Predicate>
- map<KeyT,DataT,Traits,Compare,Combine,Alloc>& map<KeyT,DataT,Traits,Compare,Combine,Alloc>
- ::assign_if(const map<KeyT,DataT,Traits,Compare,Combine,Alloc>& src, const Predicate& pred)
+ map<DomainT,CodomainT,Traits,Compare,Combine,Alloc>& map<DomainT,CodomainT,Traits,Compare,Combine,Alloc>
+ ::assign_if(const map<DomainT,CodomainT,Traits,Compare,Combine,Alloc>& src, const Predicate& pred)
{
clear();
const_iterator it = src.begin();
@@ -491,13 +491,13 @@
return *this;
}
//-------------------------------------------------------------------------
- template <typename KeyT, typename DataT, class Traits,
+ template <typename DomainT, typename CodomainT, class Traits,
ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
- map<KeyT,DataT,Traits,Compare,Combine,Alloc>&
- insert(map<KeyT,DataT,Traits,Compare,Combine,Alloc>& object,
- const map<KeyT,DataT,Traits,Compare,Combine,Alloc>& insertee)
+ map<DomainT,CodomainT,Traits,Compare,Combine,Alloc>&
+ insert(map<DomainT,CodomainT,Traits,Compare,Combine,Alloc>& object,
+ const map<DomainT,CodomainT,Traits,Compare,Combine,Alloc>& insertee)
{
- typedef map<KeyT,DataT,Traits,Compare,Combine,Alloc> map_type;
+ typedef map<DomainT,CodomainT,Traits,Compare,Combine,Alloc> map_type;
const_FORALL(typename map_type, elem_, insertee)
object.insert(*elem_);
@@ -505,13 +505,13 @@
return object;
}
- template <typename KeyT, typename DataT, class Traits,
+ template <typename DomainT, typename CodomainT, class Traits,
ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
- map<KeyT,DataT,Traits,Compare,Combine,Alloc>&
- erase(map<KeyT,DataT,Traits,Compare,Combine,Alloc>& object,
- const map<KeyT,DataT,Traits,Compare,Combine,Alloc>& erasee)
+ map<DomainT,CodomainT,Traits,Compare,Combine,Alloc>&
+ erase(map<DomainT,CodomainT,Traits,Compare,Combine,Alloc>& object,
+ const map<DomainT,CodomainT,Traits,Compare,Combine,Alloc>& erasee)
{
- typedef map<KeyT,DataT,Traits,Compare,Combine,Alloc> map_type;
+ typedef map<DomainT,CodomainT,Traits,Compare,Combine,Alloc> map_type;
const_FORALL(typename map_type, elem_, erasee)
object.erase(*elem_);
@@ -520,29 +520,29 @@
}
//-------------------------------------------------------------------------
- template <class KeyT, class DataT, class Traits>
- struct is_interval_container<itl::map<KeyT,DataT,Traits> >
+ template <class DomainT, class CodomainT, class Traits>
+ struct is_interval_container<itl::map<DomainT,CodomainT,Traits> >
{ enum{value = true}; };
- template <class KeyT, class DataT, class Traits>
- struct is_interval_splitter<itl::map<KeyT,DataT,Traits> >
+ template <class DomainT, class CodomainT, class Traits>
+ struct is_interval_splitter<itl::map<DomainT,CodomainT,Traits> >
{ enum{value = false}; };
- template <class KeyT, class DataT, class Traits>
- struct is_neutron_absorber<itl::map<KeyT,DataT,Traits> >
+ template <class DomainT, class CodomainT, class Traits>
+ struct is_neutron_absorber<itl::map<DomainT,CodomainT,Traits> >
{ enum{value = Traits::absorbs_neutrons}; };
- template <class KeyT, class DataT, class Traits>
- struct is_neutron_emitter<itl::map<KeyT,DataT,Traits> >
+ template <class DomainT, class CodomainT, class Traits>
+ struct is_neutron_emitter<itl::map<DomainT,CodomainT,Traits> >
{ enum{value = Traits::emits_neutrons}; };
- template <class KeyT, class DataT, class Traits>
- struct type_to_string<itl::map<KeyT,DataT,Traits> >
+ template <class DomainT, class CodomainT, class Traits>
+ struct type_to_string<itl::map<DomainT,CodomainT,Traits> >
{
static std::string apply()
{
- return "map<"+ type_to_string<KeyT>::apply() + ","
- + type_to_string<DataT>::apply() + ","
+ return "map<"+ type_to_string<DomainT>::apply() + ","
+ + type_to_string<CodomainT>::apply() + ","
+ type_to_string<Traits>::apply() +">";
}
};
Modified: sandbox/itl/boost/itl/notate.hpp
==============================================================================
--- sandbox/itl/boost/itl/notate.hpp (original)
+++ sandbox/itl/boost/itl/notate.hpp 2008-12-03 15:31:23 EST (Wed, 03 Dec 2008)
@@ -77,21 +77,31 @@
// (4) Being able to check template template parameter variants against
// template type parameter variants.
-//#define ITL_USE_COMBINE_TEMPLATE_TEMPLATE
+#define ITL_USE_COMPARE_TEMPLATE_TEMPLATE
+#define ITL_USE_COMBINE_TEMPLATE_TEMPLATE
//------------------------------------------------------------------------------
-#define ITL_COMPARE template<class>class
-#define ITL_COMPARE_DOMAIN(itl_compare, domain_type) itl_compare<domain_type>
+#ifdef ITL_USE_COMPARE_TEMPLATE_TEMPLATE
+# define ITL_COMPARE template<class>class
+# define ITL_COMPARE_DOMAIN(itl_compare, domain_type) itl_compare<domain_type>
+# define ITL_COMPARE_INSTANCE(compare_instance, domain_type) compare_instance
+# define ITL_EXCLUSIVE_LESS(interval_type) exclusive_less
+#else//ITL_USE_COMPARE_TEMPLATE_TYPE
+# define ITL_COMPARE class
+# define ITL_COMPARE_DOMAIN(itl_compare, domain_type) itl_compare
+# define ITL_COMPARE_INSTANCE(compare_instance, domain_type) compare_instance<domain_type>
+# define ITL_EXCLUSIVE_LESS(interval_type) exclusive_less<interval_type>
+#endif
//------------------------------------------------------------------------------
#ifdef ITL_USE_COMBINE_TEMPLATE_TEMPLATE
-#define ITL_COMBINE template<class>class
-#define ITL_COMBINE_CODOMAIN(itl_combine, codomain_type) itl_combine<codomain_type>
-#define ITL_INPLACE_PLUS(codomain_type) itl::inplace_plus
+# define ITL_COMBINE template<class>class
+# define ITL_COMBINE_CODOMAIN(itl_combine, codomain_type) itl_combine<codomain_type>
+# define ITL_COMBINE_INSTANCE(compare_instance,codomain_type) compare_instance
#else//ITL_USE_COMBINE_TEMPLATE_TYPE
-#define ITL_COMBINE class
-#define ITL_COMBINE_CODOMAIN(itl_combine, codomain_type) itl_combine
-#define ITL_INPLACE_PLUS(codomain_type) itl::inplace_plus<codomain_type>
+# define ITL_COMBINE class
+# define ITL_COMBINE_CODOMAIN(itl_combine, codomain_type) itl_combine
+# define ITL_COMBINE_INSTANCE(compare_instance,codomain_type) compare_instance<codomain_type>
#endif
//------------------------------------------------------------------------------
Modified: sandbox/itl/boost/itl/separate_interval_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/separate_interval_set.hpp (original)
+++ sandbox/itl/boost/itl/separate_interval_set.hpp 2008-12-03 15:31:23 EST (Wed, 03 Dec 2008)
@@ -68,7 +68,7 @@
<
typename DomainT,
template<class,ITL_COMPARE>class Interval = itl::interval,
- ITL_COMPARE Compare = std::less,
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, DomainT),
ITL_ALLOC Alloc = std::allocator
>
class separate_interval_set:
@@ -94,7 +94,7 @@
typedef Interval<DomainT,Compare> interval_type;
/// Comparison functor for domain values
- typedef Compare<DomainT> domain_compare;
+ typedef ITL_COMPARE_DOMAIN(Compare,DomainT) domain_compare;
/// Comparison functor for intervals
typedef exclusive_less<interval_type> interval_compare;
@@ -114,7 +114,7 @@
typedef typename itl::set<DomainT,Compare,Alloc> atomized_type;
/// Container type for the implementation
- typedef typename itl::set<interval_type,exclusive_less,Alloc> ImplSetT;
+ typedef typename itl::set<interval_type,ITL_EXCLUSIVE_LESS(interval_type),Alloc> ImplSetT;
/// key type of the implementing container
typedef typename ImplSetT::key_type key_type;
Modified: sandbox/itl/boost/itl/set.hpp
==============================================================================
--- sandbox/itl/boost/itl/set.hpp (original)
+++ sandbox/itl/boost/itl/set.hpp 2008-12-03 15:31:23 EST (Wed, 03 Dec 2008)
@@ -68,23 +68,25 @@
*/
template
<
- typename KeyT,
- ITL_COMPARE Compare = std::less,
+ typename DomainT,
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, DomainT),
ITL_ALLOC Alloc = std::allocator
>
- class set: private std::set<KeyT, Compare<KeyT>, Alloc<KeyT> >
+ class set: private std::set<DomainT, ITL_COMPARE_DOMAIN(Compare,DomainT), Alloc<DomainT> >
{
public:
- typedef typename itl::set<KeyT, Compare, Alloc > type;
- typedef typename std::set<KeyT, Compare<KeyT>, Alloc<KeyT> > base_type;
+ typedef typename itl::set<DomainT, Compare, Alloc > type;
+ typedef typename std::set<DomainT, ITL_COMPARE_DOMAIN(Compare,DomainT), Alloc<DomainT> > base_type;
public:
- typedef KeyT key_type;
- typedef KeyT value_type;
- typedef KeyT data_type;
- typedef Compare<KeyT> key_compare;
- typedef Compare<KeyT> value_compare;
- typedef Alloc<KeyT> allocator_type;
+ typedef DomainT domain_type;
+ typedef DomainT key_type;
+ typedef DomainT value_type;
+ typedef DomainT data_type;
+ typedef ITL_COMPARE_DOMAIN(Compare,DomainT) domain_compare;
+ typedef ITL_COMPARE_DOMAIN(Compare,DomainT) key_compare;
+ typedef ITL_COMPARE_DOMAIN(Compare,DomainT) value_compare;
+ typedef Alloc<DomainT> allocator_type;
public:
typedef typename base_type::pointer pointer;
@@ -100,8 +102,8 @@
public:
set(){}
- set(const Compare<KeyT>& comp):
- std::set<KeyT, Compare<KeyT>, Alloc<KeyT> >(comp){}
+ set(const domain_compare& comp):
+ std::set<DomainT, domain_compare, Alloc<DomainT> >(comp){}
template <class InputIterator>
set(InputIterator f, InputIterator l): std::set<InputIterator>(f,l) {}
@@ -142,7 +144,7 @@
//JODO concept set
/// Checks if the element \c x is in the set
- bool contains(const KeyT& x)const { return !(find(x) == end()); }
+ bool contains(const DomainT& x)const { return !(find(x) == end()); }
/** Is <tt>*this</tt> contained in <tt>super</tt>? */
bool contained_in(const set& super)const { return Set::contained_in(*this, super); }
@@ -213,50 +215,50 @@
/** Standard equality, which is lexicographical equality of the sets
as sequences, that are given by their Compare order. */
- template <typename KeyT, ITL_COMPARE Compare, ITL_ALLOC Alloc>
- inline bool operator == (const itl::set<KeyT,Compare,Alloc>& lhs,
- const itl::set<KeyT,Compare,Alloc>& rhs)
+ template <typename DomainT, ITL_COMPARE Compare, ITL_ALLOC Alloc>
+ inline bool operator == (const itl::set<DomainT,Compare,Alloc>& lhs,
+ const itl::set<DomainT,Compare,Alloc>& rhs)
{
- typedef std::set<KeyT,Compare<KeyT>,Alloc<KeyT> > base_type;
+ typedef std::set<DomainT,ITL_COMPARE_DOMAIN(Compare,DomainT),Alloc<DomainT> > base_type;
return operator==((const base_type&)lhs, (const base_type&)rhs);
}
/** Element equality. Two sets are equal if they contain the same
elements */
- template <typename KeyT, ITL_COMPARE Compare,
+ template <typename DomainT, ITL_COMPARE Compare,
ITL_ALLOC Alloc>
- inline bool is_element_equal(const itl::set<KeyT,Compare,Alloc>& lhs,
- const itl::set<KeyT,Compare,Alloc>& rhs)
+ inline bool is_element_equal(const itl::set<DomainT,Compare,Alloc>& lhs,
+ const itl::set<DomainT,Compare,Alloc>& rhs)
{
- typedef std::set<KeyT,Compare<KeyT>,Alloc<KeyT> > base_type;
+ typedef std::set<DomainT,ITL_COMPARE_DOMAIN(Compare,DomainT),Alloc<DomainT> > base_type;
return operator==((const base_type&)lhs, (const base_type&)rhs);
}
/** Strict weak less ordering which is given by the Compare order */
- template <typename KeyT, ITL_COMPARE Compare,
+ template <typename DomainT, ITL_COMPARE Compare,
ITL_ALLOC Alloc>
- inline bool operator < (const itl::set<KeyT,Compare,Alloc>& lhs,
- const itl::set<KeyT,Compare,Alloc>& rhs)
+ inline bool operator < (const itl::set<DomainT,Compare,Alloc>& lhs,
+ const itl::set<DomainT,Compare,Alloc>& rhs)
{
- typedef std::set<KeyT,Compare<KeyT>,Alloc<KeyT> > base_type;
+ typedef std::set<DomainT,ITL_COMPARE_DOMAIN(Compare,DomainT),Alloc<DomainT> > base_type;
return operator<((const base_type&)lhs, (const base_type&)rhs);
}
/** Partial ordering which is induced by Compare */
- template <typename KeyT, ITL_COMPARE Compare,
+ template <typename DomainT, ITL_COMPARE Compare,
ITL_ALLOC Alloc>
- inline bool operator <= (const itl::set<KeyT,Compare,Alloc>& lhs,
- const itl::set<KeyT,Compare,Alloc>& rhs)
+ inline bool operator <= (const itl::set<DomainT,Compare,Alloc>& lhs,
+ const itl::set<DomainT,Compare,Alloc>& rhs)
{
- typedef std::set<KeyT,Compare<KeyT>,Alloc<KeyT> > base_type;
+ typedef std::set<DomainT,ITL_COMPARE_DOMAIN(Compare,DomainT),Alloc<DomainT> > base_type;
return operator<=((const base_type&)lhs, (const base_type&)rhs);
}
- template <typename KeyT, ITL_COMPARE Compare,
+ template <typename DomainT, ITL_COMPARE Compare,
ITL_ALLOC Alloc>
- typename set<KeyT,Compare,Alloc>::iterator
- set<KeyT,Compare,Alloc>::subtract(const value_type& val)
+ typename set<DomainT,Compare,Alloc>::iterator
+ set<DomainT,Compare,Alloc>::subtract(const value_type& val)
{
iterator it_ = find(val);
if(it_ != end())
@@ -266,24 +268,24 @@
}
- template <typename KeyT, ITL_COMPARE Compare, ITL_ALLOC Alloc>
- std::string set<KeyT,Compare,Alloc>::as_string(const char* sep)const
+ template <typename DomainT, ITL_COMPARE Compare, ITL_ALLOC Alloc>
+ std::string set<DomainT,Compare,Alloc>::as_string(const char* sep)const
{
const_iterator it_ = begin();
if(it_ == end()) return std::string();
else
{
- std::string y = to_string<KeyT>::apply(*it_++);
- while(it_ != end()) { y += sep; y += to_string<KeyT>::apply(*it_++); }
+ std::string y = to_string<DomainT>::apply(*it_++);
+ while(it_ != end()) { y += sep; y += to_string<DomainT>::apply(*it_++); }
return y;
}
}
- template <typename KeyT, ITL_COMPARE Compare, ITL_ALLOC Alloc>
+ template <typename DomainT, ITL_COMPARE Compare, ITL_ALLOC Alloc>
template <class Predicate>
- set<KeyT,Compare,Alloc>& set<KeyT,Compare,Alloc>
+ set<DomainT,Compare,Alloc>& set<DomainT,Compare,Alloc>
::erase_if(const Predicate& pred)
{
iterator it = begin();
@@ -295,10 +297,10 @@
}
- template <typename KeyT, ITL_COMPARE Compare, ITL_ALLOC Alloc>
+ template <typename DomainT, ITL_COMPARE Compare, ITL_ALLOC Alloc>
template <class Predicate>
- set<KeyT,Compare,Alloc>& set<KeyT,Compare,Alloc>
- ::assign_if(const set<KeyT,Compare,Alloc>& src, const Predicate& pred)
+ set<DomainT,Compare,Alloc>& set<DomainT,Compare,Alloc>
+ ::assign_if(const set<DomainT,Compare,Alloc>& src, const Predicate& pred)
{
clear();
const_iterator it = src.begin();
@@ -310,20 +312,20 @@
}
//-------------------------------------------------------------------------
- template <typename KeyT,
+ template <typename DomainT,
ITL_COMPARE Compare, ITL_ALLOC Alloc>
- set<KeyT,Compare,Alloc>&
- insert( set<KeyT,Compare,Alloc>& object,
- const set<KeyT,Compare,Alloc>& insertee)
+ set<DomainT,Compare,Alloc>&
+ insert( set<DomainT,Compare,Alloc>& object,
+ const set<DomainT,Compare,Alloc>& insertee)
{
return object += insertee;
}
- template <typename KeyT,
+ template <typename DomainT,
ITL_COMPARE Compare, ITL_ALLOC Alloc>
- set<KeyT,Compare,Alloc>&
- erase( set<KeyT,Compare,Alloc>& object,
- const set<KeyT,Compare,Alloc>& erasee)
+ set<DomainT,Compare,Alloc>&
+ erase( set<DomainT,Compare,Alloc>& object,
+ const set<DomainT,Compare,Alloc>& erasee)
{
return object -= erasee;
}
Modified: sandbox/itl/boost/itl/split_interval_map.hpp
==============================================================================
--- sandbox/itl/boost/itl/split_interval_map.hpp (original)
+++ sandbox/itl/boost/itl/split_interval_map.hpp 2008-12-03 15:31:23 EST (Wed, 03 Dec 2008)
@@ -130,8 +130,8 @@
typename CodomainT,
class Traits = itl::neutron_absorber,
template<class,ITL_COMPARE>class Interval = itl::interval,
- ITL_COMPARE Compare = std::less,
- ITL_COMBINE Combine = ITL_INPLACE_PLUS(CodomainT),
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, DomainT),
+ ITL_COMBINE Combine = ITL_COMBINE_INSTANCE(itl::inplace_plus, CodomainT),
ITL_ALLOC Alloc = std::allocator
>
class split_interval_map:
Modified: sandbox/itl/boost/itl/split_interval_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/split_interval_set.hpp (original)
+++ sandbox/itl/boost/itl/split_interval_set.hpp 2008-12-03 15:31:23 EST (Wed, 03 Dec 2008)
@@ -89,7 +89,7 @@
<
typename DomainT,
template<class,ITL_COMPARE>class Interval = itl::interval,
- ITL_COMPARE Compare = std::less,
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, DomainT),
ITL_ALLOC Alloc = std::allocator
>
class split_interval_set:
@@ -112,7 +112,7 @@
typedef Interval<DomainT,Compare> interval_type;
/// Comparison functor for domain values
- typedef Compare<DomainT> domain_compare;
+ typedef ITL_COMPARE_DOMAIN(Compare,DomainT) domain_compare;
/// Comparison functor for intervals
typedef exclusive_less<interval_type> interval_compare;
@@ -132,7 +132,7 @@
typedef typename itl::set<DomainT,Compare,Alloc> atomized_type;
/// Container type for the implementation
- typedef typename itl::set<interval_type,exclusive_less,Alloc> ImplSetT;
+ typedef typename itl::set<interval_type,ITL_EXCLUSIVE_LESS(interval_type),Alloc> ImplSetT;
/// key type of the implementing container
typedef typename ImplSetT::key_type key_type;
@@ -415,18 +415,19 @@
return Set::lexicographical_equal(lhs, rhs);
}
-
+ /*CL?
template <typename DomainT, template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_ALLOC Alloc>
inline bool operator < (const split_interval_set<DomainT,Interval,Compare,Alloc>& lhs,
const split_interval_set<DomainT,Interval,Compare,Alloc>& rhs)
{
split_interval_set<DomainT,Interval,Compare,Alloc> lhs_joined = lhs, rhs_joined = rhs;
- lhs_joined.join(); rhs_joined.join();
+ lhs_joined.join(); rhs_joined.join(); //JODO EFFI
return std::lexicographical_compare(
lhs_joined.begin(), lhs_joined.end(),
rhs_joined.begin(), rhs_joined.end(),
Compare<Interval<DomainT,Compare> >());
}
+ */
template <class Type>
struct is_set<itl::split_interval_set<Type> >
Modified: sandbox/itl/boost/itl_xt/episode_set.hpp
==============================================================================
--- sandbox/itl/boost/itl_xt/episode_set.hpp (original)
+++ sandbox/itl/boost/itl_xt/episode_set.hpp 2008-12-03 15:31:23 EST (Wed, 03 Dec 2008)
@@ -67,11 +67,19 @@
@author Joachim Faulhaber
*/
template <class TimeT, class TypeDomain>
-class episode_set : public itl::set<typed_episode<TimeT, TypeDomain>*, Less_TypedEpisodeATP>
+class episode_set : public itl::set<typed_episode<TimeT, TypeDomain>*,
+#ifdef ITL_USE_COMPARE_TEMPLATE_TEMPLATE
+ Less_TypedEpisodeATP
+#else
+ Less_TypedEpisodeATP<typed_episode<TimeT, TypeDomain>*>
+#endif
+ >
{
// all elements must have the same type from TypeDomain
public:
- typedef itl::set<typed_episode<TimeT, TypeDomain>*, Less_TypedEpisodeATP> base_type;
+ typedef typed_episode<TimeT, TypeDomain>* episode_type;
+ typedef itl::set<typed_episode<TimeT, TypeDomain>*,
+ ITL_COMPARE_INSTANCE(Less_TypedEpisodeATP,episode_type)> base_type;
typedef typename base_type::iterator iterator;
typedef typename base_type::const_iterator const_iterator;
Modified: sandbox/itl/libs/itl/example/boost_party/boost_party.cpp
==============================================================================
--- sandbox/itl/libs/itl/example/boost_party/boost_party.cpp (original)
+++ sandbox/itl/libs/itl/example/boost_party/boost_party.cpp 2008-12-03 15:31:23 EST (Wed, 03 Dec 2008)
@@ -71,7 +71,7 @@
#ifdef ITL_USE_COMBINE_TEMPLATE_TEMPLATE
typedef interval_map<ptime, int, neutron_absorber, interval, less, inplace_max > BoostPartyHeightHistoryT;
#else
-typedef interval_map<ptime, int, neutron_absorber, interval, less, inplace_max<int> > BoostPartyHeightHistoryT;
+typedef interval_map<ptime, int, neutron_absorber, interval, less<ptime>, inplace_max<int> > BoostPartyHeightHistoryT;
#endif
void boost_party()
Modified: sandbox/itl/libs/itl/test/test_interval_map_shared.hpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_interval_map_shared.hpp (original)
+++ sandbox/itl/libs/itl/test/test_interval_map_shared.hpp 2008-12-03 15:31:23 EST (Wed, 03 Dec 2008)
@@ -13,8 +13,8 @@
template <template<class T, class U,
class Traits = neutron_absorber,
template<class,ITL_COMPARE>class Interval = interval,
- ITL_COMPARE Compare = std::less,
- ITL_COMBINE Combine = ITL_INPLACE_PLUS(U),
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, U),
+ ITL_COMBINE Combine = ITL_COMBINE_INSTANCE(itl::inplace_plus, U),
ITL_ALLOC Alloc = std::allocator
>class IntervalMap,
class T, class U>
@@ -161,8 +161,8 @@
template <template<class T, class U,
class Traits = neutron_absorber,
template<class,ITL_COMPARE>class Interval = interval,
- ITL_COMPARE Compare = std::less,
- ITL_COMBINE Combine = ITL_INPLACE_PLUS(U),
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, U),
+ ITL_COMBINE Combine = ITL_COMBINE_INSTANCE(itl::inplace_plus, U),
ITL_ALLOC Alloc = std::allocator
>class IntervalMap,
class T, class U>
@@ -223,8 +223,8 @@
template <template<class T, class U,
class Traits = neutron_absorber,
template<class,ITL_COMPARE>class Interval = interval,
- ITL_COMPARE Compare = std::less,
- ITL_COMBINE Combine = ITL_INPLACE_PLUS(U),
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, U),
+ ITL_COMBINE Combine = ITL_COMBINE_INSTANCE(itl::inplace_plus, U),
ITL_ALLOC Alloc = std::allocator
>class IntervalMap,
class T, class U>
@@ -277,8 +277,8 @@
template <template<class T, class U,
class Traits = neutron_absorber,
template<class,ITL_COMPARE>class Interval = interval,
- ITL_COMPARE Compare = std::less,
- ITL_COMBINE Combine = ITL_INPLACE_PLUS(U),
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, U),
+ ITL_COMBINE Combine = ITL_COMBINE_INSTANCE(itl::inplace_plus, U),
ITL_ALLOC Alloc = std::allocator
>class IntervalMap,
class T, class U>
@@ -309,8 +309,8 @@
template <template<class T, class U,
class Traits = neutron_absorber,
template<class,ITL_COMPARE>class Interval = interval,
- ITL_COMPARE Compare = std::less,
- ITL_COMBINE Combine = ITL_INPLACE_PLUS(U),
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, U),
+ ITL_COMBINE Combine = ITL_COMBINE_INSTANCE(itl::inplace_plus, U),
ITL_ALLOC Alloc = std::allocator
>class IntervalMap,
class T, class U>
@@ -359,8 +359,8 @@
template <template<class T, class U,
class Traits = neutron_absorber,
template<class,ITL_COMPARE>class Interval = interval,
- ITL_COMPARE Compare = std::less,
- ITL_COMBINE Combine = ITL_INPLACE_PLUS(U),
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, U),
+ ITL_COMBINE Combine = ITL_COMBINE_INSTANCE(itl::inplace_plus, U),
ITL_ALLOC Alloc = std::allocator
>class IntervalMap,
class T, class U>
@@ -411,8 +411,8 @@
template <template<class T, class U,
class Traits = neutron_absorber,
template<class,ITL_COMPARE>class Interval = interval,
- ITL_COMPARE Compare = std::less,
- ITL_COMBINE Combine = ITL_INPLACE_PLUS(U),
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, U),
+ ITL_COMBINE Combine = ITL_COMBINE_INSTANCE(itl::inplace_plus, U),
ITL_ALLOC Alloc = std::allocator
>class IntervalMap,
class T, class U>
@@ -454,8 +454,8 @@
template <template<class T, class U,
class Traits = neutron_absorber,
template<class,ITL_COMPARE>class Interval = interval,
- ITL_COMPARE Compare = std::less,
- ITL_COMBINE Combine = ITL_INPLACE_PLUS(U),
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, U),
+ ITL_COMBINE Combine = ITL_COMBINE_INSTANCE(itl::inplace_plus, U),
ITL_ALLOC Alloc = std::allocator
>class IntervalMap,
class T, class U>
@@ -517,8 +517,8 @@
template <template<class T, class U,
class Traits = neutron_absorber,
template<class,ITL_COMPARE>class Interval = interval,
- ITL_COMPARE Compare = std::less,
- ITL_COMBINE Combine = ITL_INPLACE_PLUS(U),
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, U),
+ ITL_COMBINE Combine = ITL_COMBINE_INSTANCE(itl::inplace_plus, U),
ITL_ALLOC Alloc = std::allocator
>class IntervalMap,
class T, class U>
@@ -629,8 +629,8 @@
template <template<class T, class U,
class Traits = neutron_absorber,
template<class,ITL_COMPARE>class Interval = interval,
- ITL_COMPARE Compare = std::less,
- ITL_COMBINE Combine = ITL_INPLACE_PLUS(U),
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, U),
+ ITL_COMBINE Combine = ITL_COMBINE_INSTANCE(itl::inplace_plus, U),
ITL_ALLOC Alloc = std::allocator
>class IntervalMap,
class T, class U>
@@ -745,8 +745,8 @@
template <template<class T, class U,
class Traits = neutron_absorber,
template<class,ITL_COMPARE>class Interval = interval,
- ITL_COMPARE Compare = std::less,
- ITL_COMBINE Combine = ITL_INPLACE_PLUS(U),
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, U),
+ ITL_COMBINE Combine = ITL_COMBINE_INSTANCE(itl::inplace_plus, U),
ITL_ALLOC Alloc = std::allocator
>class IntervalMap,
class T, class U>
Modified: sandbox/itl/libs/itl/test/test_interval_set_shared.hpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_interval_set_shared.hpp (original)
+++ sandbox/itl/libs/itl/test/test_interval_set_shared.hpp 2008-12-03 15:31:23 EST (Wed, 03 Dec 2008)
@@ -9,9 +9,9 @@
#define __test_itl_interval_set_shared_h_JOFA_080920__
-template <template<class T, template<class,template<class>class>class = interval,
- template<class>class = std::less,
- template<class>class = std::allocator
+template <template<class T, template<class,ITL_COMPARE>class Interval = interval,
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, T),
+ ITL_ALLOC Alloc = std::allocator
>class IntervalSet,
class T>
void interval_set_fundamentals_4_ordered_types()
@@ -141,9 +141,9 @@
-template <template<class T, template<class,template<class>class>class = interval,
- template<class>class = std::less,
- template<class>class = std::allocator
+template <template<class T, template<class,ITL_COMPARE>class Interval = interval,
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, T),
+ ITL_ALLOC Alloc = std::allocator
>class IntervalSet,
class T>
void interval_set_ctor_4_bicremental_types()
@@ -192,9 +192,9 @@
}
-template <template<class T, template<class,template<class>class>class = interval,
- template<class>class = std::less,
- template<class>class = std::allocator
+template <template<class T, template<class,ITL_COMPARE>class Interval = interval,
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, T),
+ ITL_ALLOC Alloc = std::allocator
>class IntervalSet,
class T>
void interval_set_add_sub_4_bicremental_types()
@@ -234,9 +234,9 @@
}
-template <template<class T, template<class,template<class>class>class = interval,
- template<class>class = std::less,
- template<class>class = std::allocator
+template <template<class T, template<class,ITL_COMPARE>class Interval = interval,
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, T),
+ ITL_ALLOC Alloc = std::allocator
>class IntervalSet,
class T>
void interval_set_distinct_4_bicremental_types()
@@ -260,9 +260,9 @@
}
-template <template<class T, template<class,template<class>class>class = interval,
- template<class>class = std::less,
- template<class>class = std::allocator
+template <template<class T, template<class,ITL_COMPARE>class Interval = interval,
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, T),
+ ITL_ALLOC Alloc = std::allocator
>class IntervalSet,
class T>
void interval_set_distinct_4_bicremental_continuous_types()
@@ -301,9 +301,9 @@
}
-template <template<class T, template<class,template<class>class>class = interval,
- template<class>class = std::less,
- template<class>class = std::allocator
+template <template<class T, template<class,ITL_COMPARE>class Interval = interval,
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, T),
+ ITL_ALLOC Alloc = std::allocator
>class IntervalSet,
class T>
void interval_set_isolate_4_bicremental_continuous_types()
@@ -345,9 +345,9 @@
}
-template <template<class T, template<class,template<class>class>class = interval,
- template<class>class = std::less,
- template<class>class = std::allocator
+template <template<class T, template<class,ITL_COMPARE>class Interval = interval,
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, T),
+ ITL_ALLOC Alloc = std::allocator
>class IntervalSet,
class T>
void interval_set_contains_4_bicremental_types()
@@ -383,9 +383,9 @@
}
-template <template<class T, template<class,template<class>class>class = interval,
- template<class>class = std::less,
- template<class>class = std::allocator
+template <template<class T, template<class,ITL_COMPARE>class Interval = interval,
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, T),
+ ITL_ALLOC Alloc = std::allocator
>class IntervalSet,
class T>
void interval_set_operators_4_bicremental_types()
@@ -426,9 +426,9 @@
// Test for nontrivial intersection of interval sets with intervals and values
-template <template<class T, template<class,template<class>class>class = interval,
- template<class>class = std::less,
- template<class>class = std::allocator
+template <template<class T, template<class,ITL_COMPARE>class Interval = interval,
+ ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, T),
+ ITL_ALLOC Alloc = std::allocator
>class IntervalSet,
class T>
void interval_set_base_intersect_4_bicremental_types()
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