|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r50079 - in sandbox/itl: boost/itl libs/itl/example/boost_party libs/itl/test libs/itl_xt/test/meta_functors
From: afojgo_at_[hidden]
Date: 2008-12-02 17:31:03
Author: jofaber
Date: 2008-12-02 17:31:02 EST (Tue, 02 Dec 2008)
New Revision: 50079
URL: http://svn.boost.org/trac/boost/changeset/50079
Log:
Refactored: Introduced macros for conditional compilation of Combine as template template parameter
or template type parameter. Itl compiles and runs now for both versions.
Stable {msvc-9.0}
Text files modified:
sandbox/itl/boost/itl/functors.hpp | 53 +++++++++++++++++++++--
sandbox/itl/boost/itl/interval_base_map.hpp | 65 ++++++++++++++++++++++++++--
sandbox/itl/boost/itl/interval_map.hpp | 41 +++++++++---------
sandbox/itl/boost/itl/map.hpp | 23 +++++-----
sandbox/itl/boost/itl/map_algo.hpp | 5 -
sandbox/itl/boost/itl/notate.hpp | 17 +++++++
sandbox/itl/boost/itl/split_interval_map.hpp | 12 ++--
sandbox/itl/libs/itl/example/boost_party/boost_party.cpp | 2
sandbox/itl/libs/itl/test/test_interval_map_shared.hpp | 88 ++++++++++++++++++++--------------------
sandbox/itl/libs/itl_xt/test/meta_functors/meta_functors.cpp | 71 +++++++++++++++++++++++++++----
10 files changed, 270 insertions(+), 107 deletions(-)
Modified: sandbox/itl/boost/itl/functors.hpp
==============================================================================
--- sandbox/itl/boost/itl/functors.hpp (original)
+++ sandbox/itl/boost/itl/functors.hpp 2008-12-02 17:31:02 EST (Tue, 02 Dec 2008)
@@ -158,19 +158,60 @@
//--------------------------------------------------------------------------
// Inverse functor
+#ifdef ITL_USE_COMBINE_TEMPLATE
template<template<class>class Functor, class Type> struct inverse;
template<class Type>
struct inverse<itl::inplace_plus, Type>
- {
- typedef itl::inplace_minus<Type> type;
- };
+ { typedef itl::inplace_minus<Type> type; };
+
+ template<class Type>
+ struct inverse<itl::inplace_minus, Type>
+ { typedef itl::inplace_plus<Type> type; };
template<class Type>
struct inverse<itl::inplace_star, Type>
- {
- typedef itl::inplace_div<Type> type;
- };
+ { typedef itl::inplace_div<Type> type; };
+
+ template<class Type>
+ struct inverse<itl::inplace_div, Type>
+ { typedef itl::inplace_star<Type> type; };
+
+ template<class Type>
+ struct inverse<itl::inplace_max, Type>
+ { typedef itl::inplace_min<Type> type; };
+
+ template<class Type>
+ struct inverse<itl::inplace_min, Type>
+ { typedef itl::inplace_max<Type> type; };
+
+#else //ITL_USE_COMBINE_TYPE
+ template<class Functor, class Type> struct inverse;
+
+ template<class Type>
+ struct inverse<itl::inplace_plus<Type>, Type>
+ { typedef itl::inplace_minus<Type> type; };
+
+ template<class Type>
+ struct inverse<itl::inplace_minus<Type>, Type>
+ { typedef itl::inplace_plus<Type> type; };
+
+ template<class Type>
+ struct inverse<itl::inplace_star<Type>, Type>
+ { typedef itl::inplace_div<Type> type; };
+
+ template<class Type>
+ struct inverse<itl::inplace_div<Type>, Type>
+ { typedef itl::inplace_star<Type> type; };
+
+ template<class Type>
+ struct inverse<itl::inplace_max<Type>, Type>
+ { typedef itl::inplace_min<Type> type; };
+
+ template<class Type>
+ struct inverse<itl::inplace_min<Type>, Type>
+ { typedef itl::inplace_max<Type> type; };
+#endif
}} // namespace itl boost
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-02 17:31:02 EST (Tue, 02 Dec 2008)
@@ -137,7 +137,7 @@
class Traits = itl::neutron_absorber,
template<class,ITL_COMPARE>class Interval = itl::interval,
ITL_COMPARE Compare = std::less,
- ITL_COMBINE Combine = itl::inplace_plus,
+ ITL_COMBINE Combine = ITL_INPLACE_PLUS(CodomainT),
ITL_ALLOC Alloc = std::allocator
>
#ifdef USE_CONCEPTS
@@ -186,7 +186,8 @@
/// Comparison functor for domain values
typedef Compare<DomainT> domain_compare;
/// Combine functor for codomain values
- typedef Combine<DomainT> codomain_combine;
+ //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;
@@ -226,6 +227,58 @@
Traits,Compare,Combine,Alloc> atomized_type;
//@}
+private:
+ struct access : SubType
+ {
+ static bool contains(const SubType& subject, const typename SubType::value_type& operand)
+ {
+ bool (SubType::*fp)(const typename SubType::value_type&)const = &access::contains_;
+ return (subject.*fp)(operand);
+ }
+
+ template<class OperandT, class Combiner>
+ static void add(SubType& subject, const OperandT& operand, const Combiner& combine)
+ {
+ void (SubType::*fp)(const OperandT&, const Combiner&) = &access::add_;
+ (subject.*fp)(operand, combine);
+ }
+
+ template<class OperandT, class Combiner>
+ static void subtract(SubType& subject, const OperandT& operand, const Combiner& combine)
+ {
+ void (SubType::*fp)(const OperandT&, const Combiner&) = &access::subtract_;
+ (subject.*fp)(operand, combine);
+ }
+
+ template<class OperandT>
+ static void add(SubType& subject, const OperandT& operand)
+ {
+ void (SubType::*fp)(const OperandT&) = &access::add_;
+ (subject.*fp)(operand);
+ }
+
+ template<class OperandT>
+ static void subtract(SubType& subject, const OperandT& operand)
+ {
+ void (SubType::*fp)(const OperandT&) = &access::subtract_;
+ (subject.*fp)(operand);
+ }
+
+ template<class OperandT>
+ static void insert(SubType& subject, const OperandT& operand)
+ {
+ void (SubType::*fp)(const OperandT&) = &access::insert_;
+ (subject.*fp)(operand);
+ }
+
+ template<class OperandT>
+ static void erase(SubType& subject, const OperandT& operand)
+ {
+ void (SubType::*fp)(const OperandT&) = &access::erase_;
+ (subject.*fp)(operand);
+ }
+ };
+
public:
inline static bool has_symmetric_difference()
{ return is_set<codomain_type>::value || !traits::absorbs_neutrons || traits::emits_neutrons; }
@@ -394,7 +447,7 @@
<tt>m0=m; m.add(x); m.subtract(x);</tt> implies <tt>m==m0 </tt>
*/
SubType& add(const value_type& x)
- { that()->template add_<Combine<CodomainT> >(x); return *that(); }
+ { that()->template add_<codomain_combine>(x); return *that(); }
//@}
@@ -495,7 +548,7 @@
*/
SubType& insert(const base_pair_type& x)
{
- that()->insert_(value_type(interval_type(x.key), x.data) );
+ access::insert(*that(), value_type(interval_type(x.key), x.data) );
return *that();
}
@@ -511,7 +564,7 @@
\c insert(x) is equivalent to \c add<inplace_identity>(x)
*/
SubType& insert(const value_type& x)
- { that()->insert_(x); return *that(); }
+ { access::insert(*that(), x); return *that(); }
/// Erase a base value pair from the map
/** Erase a base value pair <tt>x=(k,y)</tt>.
@@ -981,7 +1034,7 @@
if(is_set<CodomainT>::value)
section.that()->template add<inplace_star<CodomainT> >(value_type(common_interval, sectant.CONT_VALUE));
else
- section.that()->template add<Combine<CodomainT> >(value_type(common_interval, sectant.CONT_VALUE));
+ section.that()->template add<codomain_combine>(value_type(common_interval, sectant.CONT_VALUE));
}
}
}
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-02 17:31:02 EST (Tue, 02 Dec 2008)
@@ -109,10 +109,11 @@
class Traits = itl::neutron_absorber,
template<class,ITL_COMPARE>class Interval = itl::interval,
ITL_COMPARE Compare = std::less,
- ITL_COMPARE Combine = itl::inplace_plus,
+ ITL_COMBINE Combine = ITL_INPLACE_PLUS(CodomainT),
ITL_ALLOC Alloc = std::allocator
>
class interval_map:
+
public interval_base_map<interval_map<DomainT,CodomainT,Traits,Interval,Compare,Combine,Alloc>,
DomainT,CodomainT,Traits,Interval,Compare,Combine,Alloc>
{
@@ -235,7 +236,7 @@
} ;
-template <typename DomainT, typename CodomainT, class Traits, template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMPARE Combine, ITL_ALLOC Alloc>
+template <typename DomainT, typename CodomainT, class Traits, template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
bool interval_map<DomainT,CodomainT,Traits,Interval,Compare,Combine,Alloc>
::contains_(const value_type& interv_value)const
{
@@ -250,7 +251,7 @@
template <typename DomainT, typename CodomainT, class Traits,
- template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMPARE Combine, ITL_ALLOC Alloc>
+ template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
bool interval_map<DomainT,CodomainT,Traits,Interval,Compare,Combine,Alloc>
::joinable(const iterator& some, const iterator& next)const
{
@@ -260,7 +261,7 @@
}
template <typename DomainT, typename CodomainT, class Traits,
- template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMPARE Combine, ITL_ALLOC Alloc>
+ template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
typename interval_map<DomainT,CodomainT,Traits,Interval,Compare,Combine,Alloc>::iterator
interval_map<DomainT,CodomainT,Traits,Interval,Compare,Combine,Alloc>
::joint_insert(iterator& left_it, const iterator& right_it)
@@ -290,7 +291,7 @@
template <typename DomainT, typename CodomainT, class Traits,
- template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMPARE Combine, ITL_ALLOC Alloc>
+ template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
bool interval_map<DomainT,CodomainT,Traits,Interval,Compare,Combine,Alloc>
::join_left(iterator& it)
{
@@ -312,7 +313,7 @@
}
template <typename DomainT, typename CodomainT, class Traits,
- template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMPARE Combine, ITL_ALLOC Alloc>
+ template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
bool interval_map<DomainT,CodomainT,Traits,Interval,Compare,Combine,Alloc>
::join_right(iterator& it)
{
@@ -334,7 +335,7 @@
template <typename DomainT, typename CodomainT, class Traits,
- template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMPARE Combine, ITL_ALLOC Alloc>
+ template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
typename interval_map<DomainT,CodomainT,Traits,Interval,Compare,Combine,Alloc>::iterator
interval_map<DomainT,CodomainT,Traits,Interval,Compare,Combine,Alloc>
::fill_join_left(const value_type& value)
@@ -353,7 +354,7 @@
}
template <typename DomainT, typename CodomainT, class Traits,
- template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMPARE Combine, ITL_ALLOC Alloc>
+ template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
typename interval_map<DomainT,CodomainT,Traits,Interval,Compare,Combine,Alloc>::iterator
interval_map<DomainT,CodomainT,Traits,Interval,Compare,Combine,Alloc>
::fill_join_both(const value_type& value)
@@ -373,7 +374,7 @@
//-----------------------------------------------------------------------------
template <typename DomainT, typename CodomainT, class Traits,
- template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMPARE Combine, ITL_ALLOC Alloc>
+ template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
template<class Combiner>
typename interval_map<DomainT,CodomainT,Traits,Interval,Compare,Combine,Alloc>::iterator
interval_map<DomainT,CodomainT,Traits,Interval,Compare,Combine,Alloc>
@@ -401,7 +402,7 @@
}
template <typename DomainT, typename CodomainT, class Traits,
- template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMPARE Combine, ITL_ALLOC Alloc>
+ template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
template<class Combiner>
typename interval_map<DomainT,CodomainT,Traits,Interval,Compare,Combine,Alloc>::iterator
interval_map<DomainT,CodomainT,Traits,Interval,Compare,Combine,Alloc>
@@ -432,7 +433,7 @@
//-----------------------------------------------------------------------------
// add<Combinator>(pair(interval,value)):
//-----------------------------------------------------------------------------
-template <typename DomainT, typename CodomainT, class Traits, template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMPARE Combine, ITL_ALLOC Alloc>
+template <typename DomainT, typename CodomainT, class Traits, template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
template<class Combiner>
void interval_map<DomainT,CodomainT,Traits,Interval,Compare,Combine,Alloc>
::add_(const value_type& x)
@@ -531,7 +532,7 @@
}
}
-template <typename DomainT, typename CodomainT, class Traits, template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMPARE Combine, ITL_ALLOC Alloc>
+template <typename DomainT, typename CodomainT, class Traits, template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
template<class Combiner>
void interval_map<DomainT,CodomainT,Traits,Interval,Compare,Combine,Alloc>
::add_rest(const interval_type& x_itv, const CodomainT& x_val, iterator& it, iterator& end_it)
@@ -564,7 +565,7 @@
add_rear<Combiner>(x_rest, x_val, it);
}
-template <typename DomainT, typename CodomainT, class Traits, template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMPARE Combine, ITL_ALLOC Alloc>
+template <typename DomainT, typename CodomainT, class Traits, template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
template<class Combiner>
void interval_map<DomainT,CodomainT,Traits,Interval,Compare,Combine,Alloc>
::add_rear(const interval_type& x_rest, const CodomainT& x_val, iterator& it)
@@ -606,7 +607,7 @@
//-----------------------------------------------------------------------------
// subtract<Combinator>(pair(interval,value)):
//-----------------------------------------------------------------------------
-template <typename DomainT, typename CodomainT, class Traits, template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMPARE Combine, ITL_ALLOC Alloc>
+template <typename DomainT, typename CodomainT, class Traits, template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
template<class Combiner>
void interval_map<DomainT,CodomainT,Traits,Interval,Compare,Combine,Alloc>
::subtract_(const value_type& x)
@@ -675,7 +676,7 @@
-template <typename DomainT, typename CodomainT, class Traits, template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMPARE Combine, ITL_ALLOC Alloc>
+template <typename DomainT, typename CodomainT, class Traits, template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
template<class Combiner>
void interval_map<DomainT,CodomainT,Traits,Interval,Compare,Combine,Alloc>
::subtract_rest(const interval_type& x_itv, const CodomainT& x_val, iterator& it, iterator& end_it)
@@ -747,7 +748,7 @@
// insert(pair(interval,value)):
//-----------------------------------------------------------------------------
template <typename DomainT, typename CodomainT, class Traits, template<class,ITL_COMPARE>class Interval,
- ITL_COMPARE Compare, ITL_COMPARE Combine, ITL_ALLOC Alloc>
+ ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
void interval_map<DomainT,CodomainT,Traits,Interval,Compare,Combine,Alloc>
::insert_(const value_type& x)
{
@@ -812,7 +813,7 @@
template <typename DomainT, typename CodomainT, class Traits, template<class,ITL_COMPARE>class Interval,
- ITL_COMPARE Compare, ITL_COMPARE Combine, ITL_ALLOC Alloc>
+ ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
void interval_map<DomainT,CodomainT,Traits,Interval,Compare,Combine,Alloc>
::insert_rest(const interval_type& x_itv, const CodomainT& x_val,
iterator& it, iterator& end_it)
@@ -840,7 +841,7 @@
}
template <typename DomainT, typename CodomainT, class Traits, template<class,ITL_COMPARE>class Interval,
- ITL_COMPARE Compare, ITL_COMPARE Combine, ITL_ALLOC Alloc>
+ ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
void interval_map<DomainT,CodomainT,Traits,Interval,Compare,Combine,Alloc>
::insert_rear(const interval_type& x_rest, const CodomainT& x_val,
iterator& it)
@@ -870,7 +871,7 @@
//-----------------------------------------------------------------------------
// erase(pair(interval,value)):
//-----------------------------------------------------------------------------
-template <typename DomainT, typename CodomainT, class Traits, template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMPARE Combine, ITL_ALLOC Alloc>
+template <typename DomainT, typename CodomainT, class Traits, template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
void interval_map<DomainT,CodomainT,Traits,Interval,Compare,Combine,Alloc>
::erase_(const value_type& x)
{
@@ -929,7 +930,7 @@
}
-template <typename DomainT, typename CodomainT, class Traits, template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMPARE Combine, ITL_ALLOC Alloc>
+template <typename DomainT, typename CodomainT, class Traits, template<class,ITL_COMPARE>class Interval, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
void interval_map<DomainT,CodomainT,Traits,Interval,Compare,Combine,Alloc>
::erase_rest(const interval_type& x_itv, const CodomainT& x_val,
iterator& it, iterator& end_it)
Modified: sandbox/itl/boost/itl/map.hpp
==============================================================================
--- sandbox/itl/boost/itl/map.hpp (original)
+++ sandbox/itl/boost/itl/map.hpp 2008-12-02 17:31:02 EST (Tue, 02 Dec 2008)
@@ -104,7 +104,7 @@
typename DataT,
class Traits = itl::neutron_absorber,
ITL_COMPARE Compare = std::less,
- ITL_COMBINE Combine = itl::inplace_plus,
+ ITL_COMBINE Combine = ITL_INPLACE_PLUS(DataT),
ITL_ALLOC Alloc = std::allocator
>
class map: private std::map<KeyT, DataT, Compare<KeyT>,
@@ -120,7 +120,6 @@
typedef itl::map<KeyT,DataT,itl::neutron_absorber,Compare,Combine,Alloc>
neutron_absorber_type;
-
typedef Traits traits;
public:
@@ -131,8 +130,10 @@
typedef DataT codomain_type;
typedef std::pair<const KeyT, DataT> value_type;
typedef Compare<KeyT> key_compare;
- typedef Combine<DataT> data_combine;
- typedef typename base_type::value_compare value_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 typename base_type::value_compare value_compare;
public:
typedef typename base_type::pointer pointer;
@@ -217,9 +218,9 @@
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. */
- iterator add(const value_type& value_pair) { return add<Combine>(value_pair); }
+ iterator add(const value_type& value_pair) { return add<data_combine>(value_pair); }
- template<ITL_COMBINE Combiner>
+ template<class Combiner>
iterator add(const value_type& value_pair);
iterator operator += (const value_type& value_pair) { return add(value_pair); }
@@ -238,7 +239,7 @@
{
if(Traits::emits_neutrons)
const_FORALL(typename map, it_, x2)
- this->add<inplace_minus>(*it_);
+ this->add<inverse_data_combine>(*it_);
else Set::subtract(*this, x2);
return *this;
}
@@ -366,7 +367,7 @@
}
template <typename KeyT, typename DataT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_ALLOC Alloc>
- template <ITL_COMBINE Combiner>
+ template <class Combiner>
typename map<KeyT,DataT,Traits,Compare,Combine,Alloc>::iterator
map<KeyT,DataT,Traits,Compare,Combine,Alloc>::add(const value_type& val)
{
@@ -377,7 +378,7 @@
if(Traits::emits_neutrons)
{
DataT added_val = DataT();
- Combiner<DataT>()(added_val, val.CONT_VALUE);
+ Combiner()(added_val, val.CONT_VALUE);
insertion = insert(value_type(val.KEY_VALUE, added_val));
}
else // Existential case
@@ -388,7 +389,7 @@
else
{
iterator it = insertion.ITERATOR;
- Combiner<DataT>()((*it).CONT_VALUE, val.CONT_VALUE);
+ Combiner()((*it).CONT_VALUE, val.CONT_VALUE);
if(Traits::absorbs_neutrons && (*it).CONT_VALUE == DataT())
{
@@ -425,7 +426,7 @@
map<KeyT,DataT,Traits,Compare,Combine,Alloc>::subtract(const value_type& val)
{
if(Traits::emits_neutrons)
- return add<inplace_minus>(val);
+ return add<inverse_data_combine>(val);
else
{
iterator it_ = find(val.KEY_VALUE);
Modified: sandbox/itl/boost/itl/map_algo.hpp
==============================================================================
--- sandbox/itl/boost/itl/map_algo.hpp (original)
+++ sandbox/itl/boost/itl/map_algo.hpp 2008-12-02 17:31:02 EST (Tue, 02 Dec 2008)
@@ -105,10 +105,9 @@
{
result.insert(*x1_);
if(is_set<typename MapType::data_type>::value)
- result.template add<inplace_star>(*x2_); //MEMO template cast for gcc
+ result.template add<MapType::data_intersect>(*x2_); //MEMO template cast for gcc
else
- result.template add<inplace_plus>(*x2_);
- //result.template add<inplace_identity>(*x2_);
+ result.template add<MapType::data_combine>(*x2_);//JODO URG
}
x1_++;
}
Modified: sandbox/itl/boost/itl/notate.hpp
==============================================================================
--- sandbox/itl/boost/itl/notate.hpp (original)
+++ sandbox/itl/boost/itl/notate.hpp 2008-12-02 17:31:02 EST (Tue, 02 Dec 2008)
@@ -77,10 +77,27 @@
// (4) Being able to check template template parameter variants against
// template type parameter variants.
+#define ITL_USE_COMBINE_TEMPLATE
+
+//------------------------------------------------------------------------------
#define ITL_COMPARE template<class>class
+#define ITL_COMPARE_DOMAIN(itl_compare, domain_type) itl_compare<domain_type>
+
+//------------------------------------------------------------------------------
+#ifdef ITL_USE_COMBINE_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
+#else
+#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>
+#endif
+
+//------------------------------------------------------------------------------
#define ITL_ALLOC template<class>class
+
#endif // __itl_NOTATE_H_JOFA_990119__
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-02 17:31:02 EST (Tue, 02 Dec 2008)
@@ -131,7 +131,7 @@
class Traits = itl::neutron_absorber,
template<class,ITL_COMPARE>class Interval = itl::interval,
ITL_COMPARE Compare = std::less,
- ITL_COMBINE Combine = itl::inplace_plus,
+ ITL_COMBINE Combine = ITL_INPLACE_PLUS(CodomainT),
ITL_ALLOC Alloc = std::allocator
>
class split_interval_map:
@@ -576,7 +576,7 @@
interval_type leadGap; x_itv.left_surplus(leadGap, fst_itv);
// this is a new Interval that is a gap in the current map
- fill_gap<Combine<CodomainT> >(value_type(leadGap, x_val));
+ fill_gap<codomain_combine>(value_type(leadGap, x_val));
// only for the first there can be a leftResid: a part of *it left of x
interval_type leftResid; fst_itv.left_surplus(leftResid, x_itv);
@@ -591,7 +591,7 @@
{
interval_type endGap; x_itv.right_surplus(endGap, fst_itv);
// this is a new Interval that is a gap in the current map
- fill_gap<Combine<CodomainT> >(value_type(endGap, x_val));
+ fill_gap<codomain_combine>(value_type(endGap, x_val));
}
else
{
@@ -618,7 +618,7 @@
{
cur_itv = (*it).KEY_VALUE ;
x_rest.left_surplus(gap, cur_itv);
- fill_gap<Combine<CodomainT> >(value_type(gap, x_val));
+ fill_gap<codomain_combine>(value_type(gap, x_val));
// shrink interval
x_rest.left_subtract(cur_itv);
}
@@ -636,14 +636,14 @@
interval_type left_gap;
x_rest.left_surplus(left_gap, cur_itv);
- fill_gap<Combine<CodomainT> >(value_type(left_gap, x_val));
+ fill_gap<codomain_combine>(value_type(left_gap, x_val));
interval_type common;
cur_itv.intersect(common, x_rest);
interval_type end_gap;
x_rest.right_surplus(end_gap, cur_itv);
- fill_gap<Combine<CodomainT> >(value_type(end_gap, x_val));
+ fill_gap<codomain_combine>(value_type(end_gap, x_val));
}
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-02 17:31:02 EST (Tue, 02 Dec 2008)
@@ -68,7 +68,7 @@
typedef interval_map<ptime, GuestSetT> BoostPartyAttendenceHistoryT;
// A party's height shall be defined as the maximum height of all guests ;-)
-typedef interval_map<ptime, int, neutron_absorber, interval, less, inplace_max> BoostPartyHeightHistoryT;
+typedef interval_map<ptime, int, neutron_absorber, interval, less, inplace_max > BoostPartyHeightHistoryT;
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-02 17:31:02 EST (Tue, 02 Dec 2008)
@@ -12,10 +12,10 @@
template <template<class T, class U,
class Traits = neutron_absorber,
- template<class,template<class>class>class = interval,
- template<class>class = std::less,
- template<class>class = itl::inplace_plus,
- template<class>class = std::allocator
+ template<class,ITL_COMPARE>class Interval = interval,
+ ITL_COMPARE Compare = std::less,
+ ITL_COMBINE Combine = ITL_INPLACE_PLUS(U),
+ ITL_ALLOC Alloc = std::allocator
>class IntervalMap,
class T, class U>
void interval_map_fundamentals_4_ordered_types()
@@ -160,10 +160,10 @@
template <template<class T, class U,
class Traits = neutron_absorber,
- template<class,template<class>class>class = interval,
- template<class>class = std::less,
- template<class>class = itl::inplace_plus,
- template<class>class = std::allocator
+ template<class,ITL_COMPARE>class Interval = interval,
+ ITL_COMPARE Compare = std::less,
+ ITL_COMBINE Combine = ITL_INPLACE_PLUS(U),
+ ITL_ALLOC Alloc = std::allocator
>class IntervalMap,
class T, class U>
void interval_map_ctor_4_bicremental_types()
@@ -222,10 +222,10 @@
template <template<class T, class U,
class Traits = neutron_absorber,
- template<class,template<class>class>class = interval,
- template<class>class = std::less,
- template<class>class = itl::inplace_plus,
- template<class>class = std::allocator
+ template<class,ITL_COMPARE>class Interval = interval,
+ ITL_COMPARE Compare = std::less,
+ ITL_COMBINE Combine = ITL_INPLACE_PLUS(U),
+ ITL_ALLOC Alloc = std::allocator
>class IntervalMap,
class T, class U>
void interval_map_add_sub_4_bicremental_types()
@@ -276,10 +276,10 @@
template <template<class T, class U,
class Traits = neutron_absorber,
- template<class,template<class>class>class = interval,
- template<class>class = std::less,
- template<class>class = itl::inplace_plus,
- template<class>class = std::allocator
+ template<class,ITL_COMPARE>class Interval = interval,
+ ITL_COMPARE Compare = std::less,
+ ITL_COMBINE Combine = ITL_INPLACE_PLUS(U),
+ ITL_ALLOC Alloc = std::allocator
>class IntervalMap,
class T, class U>
void interval_map_distinct_4_bicremental_types()
@@ -308,10 +308,10 @@
template <template<class T, class U,
class Traits = neutron_absorber,
- template<class,template<class>class>class = interval,
- template<class>class = std::less,
- template<class>class = itl::inplace_plus,
- template<class>class = std::allocator
+ template<class,ITL_COMPARE>class Interval = interval,
+ ITL_COMPARE Compare = std::less,
+ ITL_COMBINE Combine = ITL_INPLACE_PLUS(U),
+ ITL_ALLOC Alloc = std::allocator
>class IntervalMap,
class T, class U>
void interval_map_distinct_4_bicremental_continuous_types()
@@ -358,10 +358,10 @@
template <template<class T, class U,
class Traits = neutron_absorber,
- template<class,template<class>class>class = interval,
- template<class>class = std::less,
- template<class>class = itl::inplace_plus,
- template<class>class = std::allocator
+ template<class,ITL_COMPARE>class Interval = interval,
+ ITL_COMPARE Compare = std::less,
+ ITL_COMBINE Combine = ITL_INPLACE_PLUS(U),
+ ITL_ALLOC Alloc = std::allocator
>class IntervalMap,
class T, class U>
void interval_map_isolate_4_bicremental_continuous_types()
@@ -410,10 +410,10 @@
template <template<class T, class U,
class Traits = neutron_absorber,
- template<class,template<class>class>class = interval,
- template<class>class = std::less,
- template<class>class = itl::inplace_plus,
- template<class>class = std::allocator
+ template<class,ITL_COMPARE>class Interval = interval,
+ ITL_COMPARE Compare = std::less,
+ ITL_COMBINE Combine = ITL_INPLACE_PLUS(U),
+ ITL_ALLOC Alloc = std::allocator
>class IntervalMap,
class T, class U>
void interval_map_contains_4_bicremental_types()
@@ -453,10 +453,10 @@
template <template<class T, class U,
class Traits = neutron_absorber,
- template<class,template<class>class>class = interval,
- template<class>class = std::less,
- template<class>class = itl::inplace_plus,
- template<class>class = std::allocator
+ template<class,ITL_COMPARE>class Interval = interval,
+ ITL_COMPARE Compare = std::less,
+ ITL_COMBINE Combine = ITL_INPLACE_PLUS(U),
+ ITL_ALLOC Alloc = std::allocator
>class IntervalMap,
class T, class U>
void interval_map_operators_4_bicremental_types()
@@ -516,10 +516,10 @@
// Test for nontrivial intersection of interval maps with intervals and values
template <template<class T, class U,
class Traits = neutron_absorber,
- template<class,template<class>class>class = interval,
- template<class>class = std::less,
- template<class>class = itl::inplace_plus,
- template<class>class = std::allocator
+ template<class,ITL_COMPARE>class Interval = interval,
+ ITL_COMPARE Compare = std::less,
+ ITL_COMBINE Combine = ITL_INPLACE_PLUS(U),
+ ITL_ALLOC Alloc = std::allocator
>class IntervalMap,
class T, class U>
void interval_map_base_intersect_4_bicremental_types()
@@ -628,10 +628,10 @@
// Test for nontrivial erasure of interval maps with intervals and interval sets
template <template<class T, class U,
class Traits = neutron_absorber,
- template<class,template<class>class>class = interval,
- template<class>class = std::less,
- template<class>class = itl::inplace_plus,
- template<class>class = std::allocator
+ template<class,ITL_COMPARE>class Interval = interval,
+ ITL_COMPARE Compare = std::less,
+ ITL_COMBINE Combine = ITL_INPLACE_PLUS(U),
+ ITL_ALLOC Alloc = std::allocator
>class IntervalMap,
class T, class U>
void interval_map_base_erase_4_bicremental_types()
@@ -744,10 +744,10 @@
// Test first_collision
template <template<class T, class U,
class Traits = neutron_absorber,
- template<class,template<class>class>class = interval,
- template<class>class = std::less,
- template<class>class = itl::inplace_plus,
- template<class>class = std::allocator
+ template<class,ITL_COMPARE>class Interval = interval,
+ ITL_COMPARE Compare = std::less,
+ ITL_COMBINE Combine = ITL_INPLACE_PLUS(U),
+ ITL_ALLOC Alloc = std::allocator
>class IntervalMap,
class T, class U>
void interval_map_base_is_disjoint_4_bicremental_types()
Modified: sandbox/itl/libs/itl_xt/test/meta_functors/meta_functors.cpp
==============================================================================
--- sandbox/itl/libs/itl_xt/test/meta_functors/meta_functors.cpp (original)
+++ sandbox/itl/libs/itl_xt/test/meta_functors/meta_functors.cpp 2008-12-02 17:31:02 EST (Tue, 02 Dec 2008)
@@ -28,6 +28,7 @@
#include <iostream>
#include <set>
+#include <vector>
#include <boost/itl/functors.hpp>
#include <boost/mpl/apply.hpp>
#include <boost/mpl/placeholders.hpp>
@@ -99,14 +100,68 @@
typedef PairSet1<int, std::less<_> > PairSet1_int;
-template<template<class>class Functor, class Type> struct inverse;
-
-template<class Type>
-struct inverse<itl::inplace_plus, Type>
+template<class T,
+ template<class,class>class Vec,
+ class A = std::allocator<T> >
+class my_class
{
- typedef itl::inplace_minus<Type> type;
+public:
+ typedef Vec<T,A> vec_type;
+ my_class():_vec(1,static_cast<T>(42))
+ { std::cout<<"Aswer: "<<_vec[0]<<endl; }
+private:
+ vec_type _vec;
};
+void template_default_problem()
+{
+ my_class<double, std::vector> myInst;
+}
+
+/*
+template<class T,
+ class C = std::less<T>,
+ class A = std::allocator<T> >
+class interval_set
+{
+public:
+ typedef
+ set<interval<T>,
+ exclusive_less<interval<T> >
+ A::allocator_template<interval<T> >//error
+ > impl_type; // ^^^^ No language support
+
+ typedef set<T,C,A> atomized_type;
+
+ // Return the interval set as a set of elements
+ void atomize(atomized_type& atomized);
+}
+
+template<
+ class T,
+ class C = std::less<T>,
+ template<class>class A = std::allocator
+>
+class my_interval_set
+{
+public:
+ typedef
+ set<interval<T>,
+ exclusive_less<interval<T> >
+ A<interval<T> > //ok now
+ > impl_type;
+
+ typedef
+ set<T,C,
+ A<T> //Same allocator,
+ //different instances
+ > atomized_type;
+
+ // Return the interval set as a set of elements
+ void atomize(atomized_type& atomized);
+}
+*/
+
int main()
{
cout << ">> Interval Template Library: Test meta_functors <<\n";
@@ -119,11 +174,7 @@
PairSet1_int ps1;
- int x = 0, y = 0;
- itl::inplace_plus<int>()(x,2);
- inverse<itl::inplace_plus,int>::type()(y,2);
- cout << "x=" << x << endl;
- cout << "y=" << y << endl;
+ template_default_problem();
return 0;
}
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