Boost logo

Boost :

Subject: Re: [boost] [typeof] deducing type at class level
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2011-06-22 12:18:17


On 22/06/2011 18:02, lcaminiti wrote:
> Hello all,
>
> Is there any way to use BOOST_TYPEOF at class level? For example:
>
> struct vect {
> size_t size();
>
> typedef BOOST_TYPEOF(size()) size_type; // can I make this work somehow?

typedef BOOST_TYPEOF(make<vect>().size()) size_type;

with

#ifndef BOOST_NO_RVALUE_REFERENCES

template<class T>
typename enable_if<
    is_reference<T>,
    T
>::type
make();

template<class T>
typename disable_if<
    is_reference<T>,
    T&
>::type
make();

#else

T&& make();

#endif


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk