codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
#include <boost/mpl/vector.hpp> #include <boost/mpl/always.hpp> #include <boost/mpl/bool.hpp> #include <boost/mpl/find.hpp> #include <boost/mpl/switch.hpp> #include <boost/mpl/assert.hpp> #include <boost/type_traits/remove_pointer.hpp> #include <boost/type_traits/remove_reference.hpp> #include <boost/type_traits/add_pointer.hpp> #include <boost/type_traits/is_pointer.hpp> #include <boost/type_traits/is_reference.hpp> #include <boost/type_traits/is_same.hpp> using namespace boost; using namespace boost::mpl; int main() { typedef vector<case_<boost::is_pointer<_>, remove_pointer<_> > ,case_<boost::is_reference<_>, remove_reference<_> > ,default_< always<float> > > cases; typedef switch_<cases,char& >::type t1; typedef switch_<cases,int* >::type t2; typedef switch_<cases,int >::type t3; BOOST_MPL_ASSERT(( is_same<t1,char> )); BOOST_MPL_ASSERT(( is_same<t2,int> )); BOOST_MPL_ASSERT(( is_same<t3,float> )); }
Private
[
?
]
Run code
Submit