Boost logo

Boost :

From: Ralf Stoffels (stoffels_at_[hidden])
Date: 1999-02-11 14:31:14


I see a problem in the standard-library-header <funtional>.
(I hope this is the right mailing-list to discuss such problems.)

You cannot handle functional objects with bind... which use reference
parameters.

Here is simple example:

  struct A {}
  a1, a2;

  bool f(const A& a, const A& b)
  {return true;}
 
  bool b = std::bind2nd(std::ptr_fun(&f), a2) (a1); // reference to
reference error

Problem description:
  ptr_fun returns a pointer_to_binary_function<const A&, const A&,
bool> // ok

  bind2nd returns a
  binder2nd<pointer_to_binary_function<const A&, const A&, bool> >
  with the ctor:
  binder2nd (const pointer_to_binary_function<const A&, const A&, bool>&
x,
             const const A&&); // :-(
  and the
  bool operator () (const const A &&) const; // :-(

Kevin S. Van Horn has a solution for those problems:
http://www.xmission.com/~ksvhsoft/code/fct_objs.html

Ralf

------------------------------------------------------------------------
eGroup home: http://www.eGroups.com/list/boost
Free Web-based e-mail groups by eGroups.com


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk