|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r50049 - sandbox/itl/boost/itl
From: afojgo_at_[hidden]
Date: 2008-12-01 05:11:36
Author: jofaber
Date: 2008-12-01 05:11:34 EST (Mon, 01 Dec 2008)
New Revision: 50049
URL: http://svn.boost.org/trac/boost/changeset/50049
Log:
Refactored: Combiner functor static instantiation. Step 3. add_ functor.
Introduced friend decl in order to privatize CRTP-derived impl functions like add_.
Stable {msvc-9.0}
Text files modified:
sandbox/itl/boost/itl/interval_base_map.hpp | 16 ++++++++--------
sandbox/itl/boost/itl/interval_map.hpp | 12 +++++++-----
sandbox/itl/boost/itl/split_interval_map.hpp | 14 ++++++++------
3 files changed, 23 insertions(+), 19 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-12-01 05:11:34 EST (Mon, 01 Dec 2008)
@@ -417,8 +417,8 @@
private:
template<class Combiner>
- SubType& add(const value_type& x, const Combiner& combine)
- { access::add(*that(), x, combine); return *that(); }
+ SubType& add(const value_type& x)
+ { that()->template add_<Combiner>(x); return *that(); }
public:
//template<class Combiner>
@@ -459,7 +459,8 @@
<tt>m0=m; m.add(x); m.subtract(x);</tt> implies <tt>m==m0 </tt>
*/
SubType& add(const value_type& x)
- { access::add(*that(), x, Combine<CodomainT>()); return *that(); }
+ { that()->template add_<Combine<CodomainT> >(x); return *that(); }
+ //CL { access::add(*that(), x, Combine<CodomainT>()); return *that(); }
//@}
@@ -538,7 +539,8 @@
{
typedef inverse<Combine,CodomainT>::type InverseCombine;
if(Traits::emits_neutrons)
- access::add<value_type,InverseCombine>(*that(), x, InverseCombine());
+ that()->template add_<InverseCombine>(x);
+ //CL access::add<value_type,InverseCombine>(*that(), x, InverseCombine());
else
access::subtract<value_type,InverseCombine>(*that(), x, InverseCombine());
@@ -1045,11 +1047,9 @@
{
section.that()->add( value_type(common_interval, (*it).CONT_VALUE) );
if(is_set<CodomainT>::value)
- section.that()->add(value_type(common_interval, sectant.CONT_VALUE),
- inplace_star<CodomainT>());
+ section.that()->template add<inplace_star<CodomainT> >(value_type(common_interval, sectant.CONT_VALUE));
else
- section.that()->add(value_type(common_interval, sectant.CONT_VALUE),
- Combine<CodomainT>());
+ section.that()->template add<Combine<CodomainT> >(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-01 05:11:34 EST (Mon, 01 Dec 2008)
@@ -174,15 +174,17 @@
const_FORALL(typename base_map_type, it, src)
this->add(*it);
}
+
+private:
+ friend class base_type;
-protected:
bool contains_(const value_type& x)const;
template<class Combiner>
- void add_(const value_type&, const Combiner&);
+ void add_(const value_type&);
void add_(const value_type& value)
- { add_(value, Combine<CodomainT>()); }
+ { add_<Combine<CodomainT> >(value); }
template<class Combiner>
void subtract_(const value_type&, const Combiner&);
@@ -190,7 +192,7 @@
void subtract_(const value_type& value)
{
if(Traits::emits_neutrons)
- add_<inplace_minus<CodomainT> >(value, inplace_minus<CodomainT>());
+ add_<inplace_minus<CodomainT> >(value);
else
subtract_<inplace_minus<CodomainT> >(value, inplace_minus<CodomainT>());
}
@@ -440,7 +442,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 Combiner>
void interval_map<DomainT,CodomainT,Traits,Interval,Compare,Combine,Alloc>
- ::add_(const value_type& x, const Combiner& combine)
+ ::add_(const value_type& x)
{
const interval_type& x_itv = x.KEY_VALUE;
if(x_itv.empty())
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-01 05:11:34 EST (Mon, 01 Dec 2008)
@@ -189,14 +189,16 @@
this->_map.insert(*it);
}
- protected:
+ private:
+ friend class base_type;
+
bool contains_(const value_type& x)const;
template<class Combiner>
- void add_(const value_type&, const Combiner&);
+ void add_(const value_type&);
void add_(const value_type& value)
- { add_<inplace_plus<CodomainT> >(value, inplace_plus<CodomainT>()); }
+ { add_<inplace_plus<CodomainT> >(value); }
template<class Combiner>
void subtract_(const value_type&, const Combiner&);
@@ -204,9 +206,9 @@
void subtract_(const value_type& value)
{
if(Traits::emits_neutrons)
- add_<inplace_minus<CodomainT> >(value, inplace_minus<CodomainT>());
+ add_<inplace_minus<CodomainT> >(value);
else
- subtract_<inplace_minus<CodomainT> >(value, inplace_minus<CodomainT>());
+ subtract_<inplace_minus<CodomainT> >(value, inplace_minus<CodomainT>() );
}
void insert_(const value_type& value);
@@ -296,7 +298,7 @@
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 split_interval_map<DomainT,CodomainT,Traits,Interval,Compare,Combine,Alloc>
- ::add_(const value_type& x, const Combiner& combine)
+ ::add_(const value_type& x)
{
const interval_type& x_itv = x.KEY_VALUE;
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk