Boost logo

Boost Users :

From: chun ping wang (cablepuff_at_[hidden])
Date: 2008-01-26 12:16:46


cause i want to use it in a generic function and other numeric type your_int
may or not have to_int...

On Jan 26, 2008 8:59 AM, Zeljko Vrba <zvrba_at_[hidden]> wrote:

> On Sat, Jan 26, 2008 at 08:50:42AM -0800, chun ping wang wrote:
> >
> > Hi is their anyway for boost to allow only explicit conversion...
> >
> Why not just use a method?
>
> > like class MyInt
> > {
> > // some code inside....
> int to_int() const;
> > };
> >
> > 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 x = a.to_int();
>
>
> _______________________________________________
> 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