[bind] an easy way to break ORD ? (where am i wrong?)
2 Dec
2008
2 Dec
'08
1:25 p.m.
From http://www.boost.org/doc/libs/1_37_0/libs/bind/bind.html#Synopsis :
namespace { unspecified-placeholder-type-1 _1; unspecified-placeholder-type-2 _2; unspecified-placeholder-type-3 _3; // implementation defined number of additional placeholder definitions } Then I use placeholders like this: class X { void h(int); void f1() { return boost::bind(&X::h, this, _1)(3); } } As f1 is inline, it should be the same in all the translation units, to obey ODR. However, anonyomous namespace is different in a different translation unit, so _1 is different variable. Is One Definition Rule broken ?
5822
Age (days ago)
5822
Last active (days ago)
0 comments
1 participants
participants (1)
-
Alexander