|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r49622 - in sandbox/itl: boost/itl libs/itl/example/boost_party
From: afojgo_at_[hidden]
Date: 2008-11-07 08:33:40
Author: jofaber
Date: 2008-11-07 08:33:40 EST (Fri, 07 Nov 2008)
New Revision: 49622
URL: http://svn.boost.org/trac/boost/changeset/49622
Log:
Refactored Combiner passing. Combiners are now type and not template parameters, as suggested by Steven Watanabe. So
nongeneric Combiner implementations can be used as well. Stable {msvc-9.0}
Text files modified:
sandbox/itl/boost/itl/interval_base_map.hpp | 16 ++++----
sandbox/itl/boost/itl/interval_map.hpp | 70 ++++++++++++++++++++--------------------
sandbox/itl/boost/itl/split_interval_map.hpp | 60 +++++++++++++++++-----------------
sandbox/itl/libs/itl/example/boost_party/boost_party.cpp | 4 +-
4 files changed, 75 insertions(+), 75 deletions(-)
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-11-07 08:33:40 EST (Fri, 07 Nov 2008)
@@ -328,8 +328,8 @@
If Combinator implements addition (+=) associated values will contain sums.
If Combinator implements max, associated values will contain maximal values and so on.
*/
- template<template<class>class Combinator>
- SubType& add(const base_pair_type& x, const Combinator<CodomainT>& combine)
+ template<class Combiner>
+ SubType& add(const base_pair_type& x, const Combiner& combine)
{
that()->template add_(value_type(interval_type(x.KEY_VALUE), x.CONT_VALUE), combine);
return *that();
@@ -351,8 +351,8 @@
If Combinator implements addition (+=) associated values will contain sums.
If Combinator implements max, associated values will contain maximal values and so on.
*/
- template<template<class>class Combinator>
- SubType& add(const value_type& x, const Combinator<CodomainT>& combine)
+ template<class Combiner>
+ SubType& add(const value_type& x, const Combiner& combine)
{ that()->add_(x, combine); return *that(); };
/// Addition of a base value pair.
@@ -404,8 +404,8 @@
A Combinator for subtract is usually an inverse function of
the corresponding add<Combinator>.
*/
- template<template<class>class Combinator>
- SubType& subtract(const base_pair_type& x, const Combinator<CodomainT>& combine)
+ template<class Combiner>
+ SubType& subtract(const base_pair_type& x, const Combiner& combine)
{
that()->subtract_(value_type(interval_type(x.KEY_VALUE), x.CONT_VALUE), combine);
return *that();
@@ -421,8 +421,8 @@
are decremented by <tt>y</tt>. This is done via the Combinator function
that is passed a template parameter.
*/
- template<template<class>class Combinator>
- void subtract(const value_type& x, const Combinator<CodomainT>& combine)
+ template<class Combiner>
+ void subtract(const value_type& x, const Combiner& combine)
{ that()->template subtract_(x, combine); }
Modified: sandbox/itl/boost/itl/interval_map.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_map.hpp (original)
+++ sandbox/itl/boost/itl/interval_map.hpp 2008-11-07 08:33:40 EST (Fri, 07 Nov 2008)
@@ -176,14 +176,14 @@
bool contains_(const value_type& x)const;
- template<template<class>class Combinator>
- void add_(const value_type&, const Combinator<CodomainT>&);
+ template<class Combiner>
+ void add_(const value_type&, const Combiner&);
void add_(const value_type& value)
{ add_(value, inplace_plus<CodomainT>()); }
- template<template<class>class Combinator>
- void subtract_(const value_type&, const Combinator<CodomainT>&);
+ template<class Combiner>
+ void subtract_(const value_type&, const Combiner&);
void subtract_(const value_type& value)
{
@@ -212,27 +212,27 @@
bool joinable(const iterator& some, const iterator& next)const;
iterator joint_insert(iterator& some, const iterator& next);
- template<template<class>class Combinator>
- iterator fill_gap_join_left(const value_type&, const Combinator<CodomainT>&);
+ template<class Combiner>
+ iterator fill_gap_join_left(const value_type&, const Combiner&);
- template<template<class>class Combinator>
- iterator fill_gap_join_both(const value_type&, const Combinator<CodomainT>&);
+ template<class Combiner>
+ iterator fill_gap_join_both(const value_type&, const Combiner&);
iterator fill_join_left(const value_type&);
iterator fill_join_both(const value_type&);
- template<template<class>class Combinator>
+ template<class Combiner>
void add_rest(const interval_type& x_itv, const CodomainT& x_val,
- iterator& it, iterator& end_it, const Combinator<CodomainT>&);
+ iterator& it, iterator& end_it, const Combiner&);
- template<template<class>class Combinator>
+ template<class Combiner>
void add_rear(const interval_type& x_itv, const CodomainT& x_val,
- iterator& it, const Combinator<CodomainT>&);
+ iterator& it, const Combiner&);
- template<template<class>class Combinator>
+ template<class Combiner>
void subtract_rest(const interval_type& x_itv, const CodomainT& x_val,
iterator& it, iterator& end_it,
- const Combinator<CodomainT>&);
+ const Combiner&);
void insert_rest(const interval_type& x_itv, const CodomainT& x_val, iterator& it, iterator& end_it);
void insert_rear(const interval_type& x_itv, const CodomainT& x_val, iterator& it);
@@ -408,12 +408,12 @@
//-----------------------------------------------------------------------------
template <typename DomainT, typename CodomainT, class Traits,
template<class>class Interval, template<class>class Compare, template<class>class Alloc>
- template<template<class>class Combinator>
+ template<class Combiner>
typename interval_map<DomainT,CodomainT,Traits,Interval,Compare,Alloc>::iterator
interval_map<DomainT,CodomainT,Traits,Interval,Compare,Alloc>
- ::fill_gap_join_left(const value_type& value, const Combinator<CodomainT>& combine)
+ ::fill_gap_join_left(const value_type& value, const Combiner& combine)
{
- //CL static Combinator<CodomainT> combine;
+ //CL static Combiner combine;
//collision free insert is asserted
if(value.KEY_VALUE.empty())
return this->_map.end();
@@ -437,12 +437,12 @@
template <typename DomainT, typename CodomainT, class Traits,
template<class>class Interval, template<class>class Compare, template<class>class Alloc>
- template<template<class>class Combinator>
+ template<class Combiner>
typename interval_map<DomainT,CodomainT,Traits,Interval,Compare,Alloc>::iterator
interval_map<DomainT,CodomainT,Traits,Interval,Compare,Alloc>
- ::fill_gap_join_both(const value_type& value, const Combinator<CodomainT>& combine)
+ ::fill_gap_join_both(const value_type& value, const Combiner& combine)
{
- //CL static Combinator<CodomainT> combine;
+ //CL static Combiner combine;
//collision free insert is asserted
if(value.KEY_VALUE.empty())
return this->_map.end();
@@ -469,11 +469,11 @@
// add<Combinator>(pair(interval,value)):
//-----------------------------------------------------------------------------
template <typename DomainT, typename CodomainT, class Traits, template<class>class Interval, template<class>class Compare, template<class>class Alloc>
- template<template<class>class Combinator>
+ template<class Combiner>
void interval_map<DomainT,CodomainT,Traits,Interval,Compare,Alloc>
- ::add_(const value_type& x, const Combinator<CodomainT>& combine)
+ ::add_(const value_type& x, const Combiner& combine)
{
- //CL static Combinator<CodomainT> combine;
+ //CL static Combiner combine;
const interval_type& x_itv = x.KEY_VALUE;
if(x_itv.empty())
@@ -570,11 +570,11 @@
}
template <typename DomainT, typename CodomainT, class Traits, template<class>class Interval, template<class>class Compare, template<class>class Alloc>
- template<template<class>class Combinator>
+ template<class Combiner>
void interval_map<DomainT,CodomainT,Traits,Interval,Compare,Alloc>
- ::add_rest(const interval_type& x_itv, const CodomainT& x_val, iterator& it, iterator& end_it, const Combinator<CodomainT>& combine)
+ ::add_rest(const interval_type& x_itv, const CodomainT& x_val, iterator& it, iterator& end_it, const Combiner& combine)
{
- //CL static Combinator<CodomainT> combine;
+ //CL static Combiner combine;
iterator nxt_it = it; nxt_it++;
interval_type x_rest = x_itv, left_gap, common, cur_itv;
@@ -605,11 +605,11 @@
}
template <typename DomainT, typename CodomainT, class Traits, template<class>class Interval, template<class>class Compare, template<class>class Alloc>
- template<template<class>class Combinator>
+ template<class Combiner>
void interval_map<DomainT,CodomainT,Traits,Interval,Compare,Alloc>
- ::add_rear(const interval_type& x_rest, const CodomainT& x_val, iterator& it, const Combinator<CodomainT>& combine)
+ ::add_rear(const interval_type& x_rest, const CodomainT& x_val, iterator& it, const Combiner& combine)
{
- //CL static Combinator<CodomainT> combine;
+ //CL static Combiner combine;
interval_type cur_itv = (*it).KEY_VALUE ;
CodomainT cur_val = (*it).CONT_VALUE ;
@@ -649,11 +649,11 @@
// subtract<Combinator>(pair(interval,value)):
//-----------------------------------------------------------------------------
template <typename DomainT, typename CodomainT, class Traits, template<class>class Interval, template<class>class Compare, template<class>class Alloc>
- template<template<class>class Combinator>
+ template<class Combiner>
void interval_map<DomainT,CodomainT,Traits,Interval,Compare,Alloc>
- ::subtract_(const value_type& x, const Combinator<CodomainT>& combine)
+ ::subtract_(const value_type& x, const Combiner& combine)
{
- //CL static Combinator<CodomainT> combine;
+ //CL static Combiner combine;
const interval_type& x_itv = x.KEY_VALUE;
if(x_itv.empty())
@@ -719,11 +719,11 @@
template <typename DomainT, typename CodomainT, class Traits, template<class>class Interval, template<class>class Compare, template<class>class Alloc>
- template<template<class>class Combinator>
+ template<class Combiner>
void interval_map<DomainT,CodomainT,Traits,Interval,Compare,Alloc>
- ::subtract_rest(const interval_type& x_itv, const CodomainT& x_val, iterator& it, iterator& end_it, const Combinator<CodomainT>& combine)
+ ::subtract_rest(const interval_type& x_itv, const CodomainT& x_val, iterator& it, iterator& end_it, const Combiner& combine)
{
- //CL static Combinator<CodomainT> combine;
+ //CL static Combiner combine;
iterator nxt_it=it; nxt_it++;
while(nxt_it!=end_it)
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-11-07 08:33:40 EST (Fri, 07 Nov 2008)
@@ -191,14 +191,14 @@
bool contains_(const value_type& x)const;
- template<template<class>class Combinator>
- void add_(const value_type&, const Combinator<CodomainT>&);
+ template<class Combiner>
+ void add_(const value_type&, const Combiner&);
void add_(const value_type& value)
{ add_(value, inplace_plus<CodomainT>()); }
- template<template<class>class Combinator>
- void subtract_(const value_type&, const Combinator<CodomainT>&);
+ template<class Combiner>
+ void subtract_(const value_type&, const Combiner&);
void subtract_(const value_type& value)
{
@@ -220,22 +220,22 @@
void fill(const value_type&);
- template<template<class>class Combinator>
- void fill_gap(const value_type&, const Combinator<CodomainT>& combine);
+ template<class Combiner>
+ void fill_gap(const value_type&, const Combiner& combine);
- template<template<class>class Combinator>
+ template<class Combiner>
void add_rest(const interval_type& x_itv, const CodomainT& x_val,
iterator& it, iterator& end_it,
- const Combinator<CodomainT>& combine);
+ const Combiner& combine);
- template<template<class>class Combinator>
+ template<class Combiner>
void add_rear(const interval_type& x_itv, const CodomainT& x_val,
- iterator& it, const Combinator<CodomainT>& combine);
+ iterator& it, const Combiner& combine);
- template<template<class>class Combinator>
+ template<class Combiner>
void subtract_rest(const interval_type& x_itv, const CodomainT& x_val,
iterator& it, iterator& end_it,
- const Combinator<CodomainT>& combine);
+ const Combiner& combine);
void insert_rest(const interval_type& x_itv, const CodomainT& x_val, iterator& it, iterator& end_it);
void insert_rear(const interval_type& x_itv, const CodomainT& x_val, iterator& it);
@@ -303,11 +303,11 @@
template <typename DomainT, typename CodomainT, class Traits,
template<class>class Interval, template<class>class Compare, template<class>class Alloc>
- template<template<class>class Combinator>
+ template<class Combiner>
void split_interval_map<DomainT,CodomainT,Traits,Interval,Compare,Alloc>
- ::fill_gap(const value_type& value, const Combinator<CodomainT>& combine)
+ ::fill_gap(const value_type& value, const Combiner& combine)
{
- //CL static Combinator<CodomainT> combine;
+ //CL static Combiner combine;
//collision free insert is asserted
if(value.KEY_VALUE.empty())
return;
@@ -328,11 +328,11 @@
// add<Combinator>(pair(interval,value)):
//-----------------------------------------------------------------------------
template <typename DomainT, typename CodomainT, class Traits, template<class>class Interval, template<class>class Compare, template<class>class Alloc>
- template<template<class>class Combinator>
+ template<class Combiner>
void split_interval_map<DomainT,CodomainT,Traits,Interval,Compare,Alloc>
- ::add_(const value_type& x, const Combinator<CodomainT>& combine)
+ ::add_(const value_type& x, const Combiner& combine)
{
- //CL static Combinator<CodomainT> combine;
+ //CL static Combiner combine;
const interval_type& x_itv = x.KEY_VALUE;
if(x_itv.empty())
@@ -413,13 +413,13 @@
}
template <typename DomainT, typename CodomainT, class Traits, template<class>class Interval, template<class>class Compare, template<class>class Alloc>
- template<template<class>class Combinator>
+ template<class Combiner>
void split_interval_map<DomainT,CodomainT,Traits,Interval,Compare,Alloc>
::add_rest(const interval_type& x_itv, const CodomainT& x_val,
iterator& it, iterator& end_it,
- const Combinator<CodomainT>& combine)
+ const Combiner& combine)
{
- //CL static Combinator<CodomainT> combine;
+ //CL static Combiner combine;
iterator nxt_it = it; nxt_it++;
interval_type x_rest = x_itv, gap, common, cur_itv;
@@ -444,12 +444,12 @@
}
template <typename DomainT, typename CodomainT, class Traits, template<class>class Interval, template<class>class Compare, template<class>class Alloc>
- template<template<class>class Combinator>
+ template<class Combiner>
void split_interval_map<DomainT,CodomainT,Traits,Interval,Compare,Alloc>
::add_rear(const interval_type& x_rest, const CodomainT& x_val, iterator& it,
- const Combinator<CodomainT>& combine)
+ const Combiner& combine)
{
- //CL static Combinator<CodomainT> combine;
+ //CL static Combiner combine;
interval_type cur_itv = (*it).KEY_VALUE ;
CodomainT cur_val = (*it).CONT_VALUE ;
@@ -481,11 +481,11 @@
// subtract<Combinator>(pair(interval,value)):
//-----------------------------------------------------------------------------
template <typename DomainT, typename CodomainT, class Traits, template<class>class Interval, template<class>class Compare, template<class>class Alloc>
- template<template<class>class Combinator>
+ template<class Combiner>
void split_interval_map<DomainT,CodomainT,Traits,Interval,Compare,Alloc>
- ::subtract_(const value_type& x, const Combinator<CodomainT>& combine)
+ ::subtract_(const value_type& x, const Combiner& combine)
{
- //CL static Combinator<CodomainT> combine;
+ //CL static Combiner combine;
const interval_type& x_itv = x.KEY_VALUE;
if(x_itv.empty())
@@ -541,13 +541,13 @@
template <typename DomainT, typename CodomainT, class Traits, template<class>class Interval, template<class>class Compare, template<class>class Alloc>
- template<template<class>class Combinator>
+ template<class Combiner>
void split_interval_map<DomainT,CodomainT,Traits,Interval,Compare,Alloc>
::subtract_rest(const interval_type& x_itv, const CodomainT& x_val,
iterator& it, iterator& end_it,
- const Combinator<CodomainT>& combine)
+ const Combiner& combine)
{
- //CL static Combinator<CodomainT> combine;
+ //CL static Combiner combine;
iterator nxt_it=it; nxt_it++;
while(nxt_it!=end_it)
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-11-07 08:33:40 EST (Fri, 07 Nov 2008)
@@ -120,7 +120,7 @@
inplace_max<int>()
);
- tallest_guest.add<inplace_max>(
+ tallest_guest.add(
make_pair(
rightopen_interval<ptime>(
time_from_string("2008-05-20 20:10"),
@@ -129,7 +129,7 @@
inplace_max<int>()
);
- tallest_guest.add<inplace_max>(
+ tallest_guest.add(
make_pair(
rightopen_interval<ptime>(
time_from_string("2008-05-20 22:15"),
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