Re: [boost] boost::bind dilemma

AMDG
OK, this compiles and works, but the fourth parameter to the outer bind, _1, must be copied each time an Insert takes place, from my understanding of how bind works.
Actually, boost::bind::operator() takes it's arguments by reference In Christ, Steven Watanabe

"Steven Watanabe" <steven@providere-consulting.com> wrote in message news:44C6887C.2070801@providere-consulting.com...
AMDG Actually, boost::bind::operator() takes it's arguments by reference
Even if it does, it still stores copies of those arguments, internally, per the documentation of boost::bind. Mike

Michael Goldshteyn wrote:
"Steven Watanabe" <steven@providere-consulting.com> wrote in message news:44C6887C.2070801@providere-consulting.com...
AMDG Actually, boost::bind::operator() takes it's arguments by reference
Even if it does, it still stores copies of those arguments, internally, per the documentation of boost::bind.
The expression boost::bind( f, x, _1 ) stores copies of f, x, and _1. When the returned function object is called, however, _1 binds directly to the first input argument, without a copy. You can test this by trying it on a noncopyable object.

The expression boost::bind( f, x, _1 ) stores copies of f, x, and _1. When the returned function object is called, however, _1 binds directly to the first input argument, without a copy. You can test this by trying it on a noncopyable object.
Aha, so only a copy of the boost::arg placeholder object is made where _1 appears and this is what is copied when the binder function object is constructed. Thanks for the clarification, Mike
participants (3)
-
Michael Goldshteyn
-
Peter Dimov
-
Steven Watanabe