Title
Refactoring of binders lead to interface breakage
Status
cd1
Section
[depr.lib.binders]
Submitter
Daniel Krügler

Created on 2008-02-14.00:00:00 last changed 171 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

Change [depr.lib.binder.1st]:

template <class Fn> 
class binder1st 
  : public unary_function<typename Fn::second_argument_type, 
                          typename Fn::result_type> { 
protected: 
  Fn fn op; 
  typename Fn::first_argument_type value; 
public: 
  binder1st(const Fn& x, 
            const typename Fn::first_argument_type& y); 
  typename Fn::result_type 
    operator()(const typename Fn::second_argument_type& x) const; 
  typename Fn::result_type 
    operator()(typename Fn::second_argument_type& x) const; 
};

-1- The constructor initializes fn op with x and value with y.

-2- operator() returns fnop(value,x).

Change [depr.lib.binder.2nd]:

template <class Fn> 
class binder2nd
  : public unary_function<typename Fn::first_argument_type, 
                          typename Fn::result_type> { 
protected: 
  Fn fn op; 
  typename Fn::second_argument_type value; 
public: 
  binder2nd(const Fn& x, 
            const typename Fn::second_argument_type& y); 
  typename Fn::result_type 
    operator()(const typename Fn::first_argument_type& x) const; 
  typename Fn::result_type 
    operator()(typename Fn::first_argument_type& x) const; 
};

-1- The constructor initializes fn op with x and value with y.

-2- operator() returns fnop(value,x).

Date: 2008-02-14.00:00:00

N2521 and its earlier predecessors have moved the old binders from [lib.binders] to [depr.lib.binders] thereby introducing some renaming of the template parameter names (Operation -> Fn). During this renaming process the protected data member op was also renamed to fn, which seems as an unnecessary interface breakage to me - even if this user access point is probably rarely used.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg3810
2008-02-14 00:00:00admincreate