|
Boost : |
From: Eric Niebler (eric_at_[hidden])
Date: 2005-08-31 15:13:11
Now that typeof has been checked into the CVS tree, what are the chances
that we can get implementations of remove_pointer, remove_bounds,
remove_reference, etc. for VC6 and VC7? See the attached message for a
link to a typeof-based implementation.
I would like to this this happen. It would fix problems in Boost.Range
and Boost.Foreach for those compilers.
-- Eric Niebler Boost Consulting www.boost-consulting.com Peder Holt wrote: > Hi. > I have started implementing some of the missing type_traits > functionality for vintage compilers using typeof. > The following are complete, and seem to work flawlessly on VC 6.5 and 7.0: > > remove_pointer > remove_reference > remove_bounds > > The source is available at: > http://groups.yahoo.com/group/boost/files/typeof_vintage.zip > > The use of typeof in this respect, makes remove_xxx much more > flexible. Would it be possible to start using this scheme for > compilers without partial template specialization support? > > #define BOOST_MAX_TYPEOF_SIZE 20 > > #include <boost/test/minimal.hpp> > //Include typeof_define.hpp in all header files where new types are > added to typeof. > #include <boost/typeof/typeof_define.hpp> > #include <complex> > > #include <boost/type_traits/remove_reference.hpp> > #include <boost/type_traits/remove_pointer.hpp> > #include <boost/type_traits/remove_bounds.hpp> > #include <boost/type_traits/is_same.hpp> > > template<typename A0> > struct X {}; > template<typename A0,unsigned int A1> > struct Y {}; > template<typename A0,typename A1,long A2> > struct Z {}; > > BOOST_TYPEOF_DEFINE_TEMPLATE(X,1,(typename)) > BOOST_TYPEOF_DEFINE_TEMPLATE(Y,2,(typename,unsigned int)) > BOOST_TYPEOF_DEFINE_TEMPLATE(Z,3,(typename,typename,long)) > > BOOST_TYPEOF_DEFINE_TEMPLATE(std::complex,1,(typename)) > > int > test_main(int, char*[]) > { > BOOST_TEST((boost::is_same<X<int>* > const[8][9],boost::remove_bounds<X<int>* > const[5][8][9]>::type>::value)); > BOOST_TEST((boost::is_same<Z<X<double&>,Y<bool[4][7],12324>,0>* > const*,boost::remove_pointer<Z<X<double&>,Y<bool[4][7],12324>,0>* > const**volatile>::type>::value)); > //VC7.1 fails to compile remove_reference. > BOOST_TEST((boost::is_same<Y<int,345>** > const,boost::remove_reference<Y<int,345>** const&>::type>::value)); > > typedef BOOST_TYPEOF(5.+std::complex<double>(6,7)) result_type; > BOOST_TEST((boost::is_same<result_type,std::complex<double> >::value)); > > return 0; > } > > -- > Peder Holt
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk