Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2008-01-26 15:42:11


class MyInt
{
// some code inside....
    operator int() {
        BOOST_STATIC_ASSERT(0 == sizeof(MyInt)); // or some mpl thing
    }
};

  "chun ping wang" <cablepuff_at_[hidden]> wrote in message news:7253f6b30801260850y6bdc052dq4fa01ff64542f93b_at_mail.gmail.com...
  Hi is their anyway for boost to allow only explicit conversion...

  like class MyInt
  {
  // some code inside....
      operator int() {}
  };

  myIntCalc(int, int);

  MyInt a, b;
  f = myInt(a, b); // compile error no implicit conversion.

  int x = boost::numeric_cast<int>(a); // k allow
  int y = static_cast<int>(b); // k allow.

------------------------------------------------------------------------------

  _______________________________________________
  Boost-users mailing list
  Boost-users_at_[hidden]
  http://lists.boost.org/mailman/listinfo.cgi/boost-users



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