Boost logo

Boost Users :

Subject: Re: [Boost-users] type_erasure question
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2013-04-07 14:22:17


AMDG

On 04/07/2013 08:40 AM, Aleksandar Fabijanic wrote:
> Looking at the type_erasure example:
>
> typedef any<boost::mpl::vector<copy_constructible<>,
> typeid_<>, addable<>>
>> any_type;
>
> any_type x(1.1);
> any_type y(1);
> any_type z(x + y);
>
> Apparently, without placeholders for x and y, this is undefined behavior.
> Am I interpreting it right? If so, shouldn't it fail to compile or at least
> throw an exception at runtime?
>

It's impossible to make this fail to compile.
Undefined behavior does not mean throw an exception;
it means all bets are off. If you add relaxed
to the concept, then you'll get an exception.

In Christ,
Steven Watanabe


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