// Copyright (C) 2004 Arkadiy Vertleyb // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) #pragma message("including typeof.hpp...") #include #pragma message("done") #include #include #include #include #include #include #include "mpl/register.hpp" #include #include #include #include #include #include #include #include #include #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() using namespace std; using namespace boost; template mpl::vector1 typeof_test_helper(); template struct typeof_test { enum {value = boost::is_same< BOOST_TYPEOF_TPL(typeof_test_helper()), mpl::vector1 >::value }; }; #pragma message("started") struct x {}; BOOST_TYPEOF_REGISTER_TYPE(x) template struct with_integrals {}; BOOST_TYPEOF_REGISTER_TEMPLATE_X(with_integrals, (class) (char) (unsigned short) (int) (unsigned long) (bool) (bool) (unsigned) ) #pragma message("integral...") BOOST_STATIC_ASSERT((typeof_test >::value)); BOOST_STATIC_ASSERT((typeof_test >::value)); #pragma message("namespace-level function pointers...") BOOST_STATIC_ASSERT(typeof_test::value); BOOST_STATIC_ASSERT(typeof_test::value); BOOST_STATIC_ASSERT(typeof_test::value); BOOST_STATIC_ASSERT(typeof_test::value); #pragma message("function references...") BOOST_STATIC_ASSERT(typeof_test::value); BOOST_STATIC_ASSERT(typeof_test::value); #ifdef BOOST_TYPEOF_COMPLIANT # pragma message("function values...") BOOST_STATIC_ASSERT(typeof_test::value); BOOST_STATIC_ASSERT(typeof_test::value); #endif//BOOST_TYPEOF_COMPLIANT #pragma message("member functions...") BOOST_STATIC_ASSERT(typeof_test::value); BOOST_STATIC_ASSERT(typeof_test::value); BOOST_STATIC_ASSERT(typeof_test::value); BOOST_STATIC_ASSERT(typeof_test::value); BOOST_STATIC_ASSERT(typeof_test::value); BOOST_STATIC_ASSERT(typeof_test::value); BOOST_STATIC_ASSERT(typeof_test::value); #pragma message("data members...") BOOST_STATIC_ASSERT(typeof_test::value); #pragma message("modifiers...") BOOST_STATIC_ASSERT((typeof_test*>::value)); #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION BOOST_STATIC_ASSERT((typeof_test&>::value)); #endif BOOST_STATIC_ASSERT((typeof_test >::value)); BOOST_STATIC_ASSERT((typeof_test >::value)); #pragma message("Lvalue test...") void lvalue_typeof_test() { int n; const int cn = 0; int& rn = n; const int& rcn = cn; int f(); //const int cf(); int& rf(); const int& rcf(); BOOST_STATIC_ASSERT((boost::is_same::value)); BOOST_STATIC_ASSERT((boost::is_same::value)); BOOST_STATIC_ASSERT((boost::is_same::value)); BOOST_STATIC_ASSERT((boost::is_same::value)); BOOST_STATIC_ASSERT((boost::is_same::value)); BOOST_STATIC_ASSERT((boost::is_same::value)); BOOST_STATIC_ASSERT((boost::is_same::value)); //BOOST_STATIC_ASSERT((boost::is_same::value)); //BOOST_STATIC_ASSERT((boost::is_same::value)); //BOOST_STATIC_ASSERT((boost::is_same::value)); } #pragma message("Noncopyable...") BOOST_TYPEOF_REGISTER_TYPE(boost::noncopyable) const boost::noncopyable& noncopiable_test_helper(); struct noncopiable_test { void bar() { BOOST_AUTO(const& v, noncopiable_test_helper()); v; // to avoid warning } }; #pragma message("STL...") BOOST_STATIC_ASSERT(typeof_test::value); BOOST_STATIC_ASSERT(typeof_test >::value); BOOST_STATIC_ASSERT(typeof_test >::value); BOOST_STATIC_ASSERT(typeof_test >::value); BOOST_STATIC_ASSERT(typeof_test >::value); BOOST_STATIC_ASSERT(typeof_test >::value); BOOST_STATIC_ASSERT((typeof_test >::value)); BOOST_STATIC_ASSERT((typeof_test >::value)); BOOST_STATIC_ASSERT(typeof_test >::value); BOOST_STATIC_ASSERT(typeof_test >::value); BOOST_STATIC_ASSERT(typeof_test >::value); #pragma message("ODR...") void odr_test() { void odr_test1(); void odr_test2(); odr_test1(); odr_test2(); } #pragma message("main()...") int main() { odr_test(); } #pragma message("done!")