forked from boostorg/typeof
Full merge from trunk at revision 41356 of entire boost-root tree.
[SVN r41370]
This commit is contained in:
@ -644,12 +644,14 @@ that allows a nested class of base to be defined in a class derived from base:
|
||||
//Use the base class to access the type.
|
||||
typedef typeof_access::id2type::type type;
|
||||
|
||||
This method has also been adapted to VC7.0, where the nested class
|
||||
Peder Holt adapted this method to VC7.0, where the nested class
|
||||
is a template class that is specialized in the derived class.
|
||||
The loopholes have been fixed in VC8.0 though, so on this compiler
|
||||
this method doesn't work.
|
||||
|
||||
In VC8.0, it seemed that all the bug-featire had been fixed, but
|
||||
Steven Watanabe managed to implement a more rigorous version of the VC7.0 fix that
|
||||
enables 'typeof' to be supported 'natively' here as well.
|
||||
|
||||
For this and many other compilers neither native `typeof` support
|
||||
For many other compilers neither native `typeof` support
|
||||
nor the trick described above is an option. For such compilers
|
||||
the emulation method is the only way of implementing `typeof`.
|
||||
|
||||
|
@ -14,3 +14,6 @@ BOOST_STATIC_ASSERT(boost::type_of::test<x[20]>::value);
|
||||
BOOST_STATIC_ASSERT(boost::type_of::test<const x>::value);
|
||||
BOOST_STATIC_ASSERT(boost::type_of::test<volatile x>::value);
|
||||
BOOST_STATIC_ASSERT(boost::type_of::test<volatile const x>::value);
|
||||
BOOST_STATIC_ASSERT(boost::type_of::test<const x&>::value);
|
||||
BOOST_STATIC_ASSERT(boost::type_of::test<const x*>::value);
|
||||
|
||||
|
@ -8,23 +8,24 @@
|
||||
#include <boost/typeof/typeof.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/mpl/size_t.hpp>
|
||||
|
||||
namespace boost { namespace type_of {
|
||||
|
||||
template<class T, class U>
|
||||
template<class T, class U>
|
||||
struct test_wrapper{};
|
||||
|
||||
template<class T>
|
||||
template<class T>
|
||||
T test_make(T*);
|
||||
|
||||
template<class T>
|
||||
template<class T>
|
||||
struct test
|
||||
{
|
||||
enum {value = boost::is_same<
|
||||
BOOST_STATIC_CONSTANT(std::size_t,value = (boost::is_same<
|
||||
BOOST_TYPEOF_TPL(test_make((test_wrapper<T, int>*)0)),
|
||||
test_wrapper<T, int>
|
||||
>::value
|
||||
};
|
||||
>::value)
|
||||
);
|
||||
};
|
||||
|
||||
}}
|
||||
|
Reference in New Issue
Block a user