Boost logo

Boost :

Subject: Re: [boost] "Simple C++11 metaprogramming"
From: Peter Dimov (lists_at_[hidden])
Date: 2015-06-05 08:42:16

Eric Niebler wrote:
> > (This implements the specification in the latest C++17 draft.)
> I'm not so sure. If a user defines a specialization for common_type<MyInt,
> int>, it won't get used when computing
common_type<MyInt, int, int>.

As it turns out, users are not allowed to specialize common_type, which is
why the C++17 specification does not concern itself with such

As a curiosity, decaying the arguments before the conditional operator is
also subtly wrong.

#include <iostream>
#include <typeinfo>

struct X
    operator int ();
    operator long () const;

struct Y
    operator int ();
    operator long () const;

int main()
    std::cout << typeid( true? declval<X const&>(): declval<Y
const&>() ).name() << std::endl;
    std::cout << typeid( true? declval<X&>(): declval<Y&>() ).name() <<
    std::cout << typeid( true? declval<X>(): declval<Y>() ).name() <<

Boost list run by bdawes at, gregod at, cpdaniel at, john at