|
Boost : |
From: Robert Ramey (ramey_at_[hidden])
Date: 2002-04-07 13:24:49
Fellow programmers,
While adding refinements to the serialization library, I came upon the
need to use remove_const from the type_traits library. From reading
the documentation I concluded that I could not use this in the absence
of partial specialization. Since I am using MSVC7.0 which as far as
I know does not support partial specialiazation, and I want the library
to be useful to users of this compiler, it seemed that I was stuck.
In the process of searching for a way around this dilema, I wrote
the following program. It suggests that remove_const works on my
platform. So either the documentation is wrong, my test is wrong,
or partial specialization is at least partially implemented in MSVC7.
Anyone care to clarify this situration for me?
Robert Ramey
#include <boost/type_traits.hpp>
#include <boost/pending/ct_if.hpp>
#include <boost/static_assert.hpp>
int main()
{
typedef int t;
// verify that non const'ed ness is detected
BOOST_STATIC_ASSERT(
! ::boost::is_const<t>::value
);
typedef const int u;
// verify that const'ed ness is detected
BOOST_STATIC_ASSERT(
::boost::is_const<u>::value
);
typedef ::boost::remove_const<u>::type v;
// verify that const'ed ness is removed
BOOST_STATIC_ASSERT(
! ::boost::is_const<v>::value
);
BOOST_STATIC_ASSERT(
(::boost::is_same<v,t>::value)
);
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk