Boost logo

Boost Users :

Subject: [Boost-users] [bind] an easy way to break ORD ? (where am i wrong?)
From: Alexander (gutenev_at_[hidden])
Date: 2008-12-02 08:25:49


>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 ?


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net