www.digitalmars.com         C & C++   DMDScript  

c++.beta - no implicit conversion with explicit constructor

reply Christof Meerwald <cmeerw web.de> writes:
template <class T>
inline bool operator!=(const T &x, const T &y)
{
  return !(x == y);
}

struct A
{
  explicit A(int init_val)
    : value(init_val)
  { }

  operator int () const
  {
    return value;
  }

 private:
  int value;
};

int main()
{
  A a(0);

  if (a != 1)
  // Error: no implicit conversion with explicit constructor
  {
    return 0;
  }

  return 1;
}

Also extracted from Boost.


bye, Christof

-- 
http://cmeerw.org                                 JID: cmeerw jabber.at
mailto cmeerw at web.de

...and what have you contributed to the Net?
Jun 08 2003
parent gf <mz_y2k yahoo...com> writes:
Christof Meerwald <cmeerw web.de> wrote in news:bbvpdi$1ffo$1
 digitaldaemon.com:

[...]

 Also extracted from Boost.
 bye, Christof
What does it take to see DM C++ in this list? (http://boost.sourceforge.net/regression-logs/) Run their regression tests and send them the results? /gf
Jun 08 2003