Boost logo

Boost :

From: Shunsuke Sogame (mb2act_at_[hidden])
Date: 2006-02-10 12:03:46


Peder Holt wrote:
> is_const and is_volatile fails to detect const and volatile arrays on VC7.1
>
> The following code prints "Success" in VC6.5 and VC8, but "Failure" in VC7.1
>
> #include <iostream>
> #include <boost/type_traits.hpp>
>
> void test(boost::mpl::true_) {
> std::cout<< "Success" << std::endl;
> }
>
> void test(boost::mpl::false_) {
> std::cout << "Failure" << std::endl;
> }
>
> int main()
> {
> boost::is_const<int const[2]>::type const_;
> boost::is_volatile<int volatile[2]>::type volatile_;
> test(const_);
> test(volatile_);
> return 0;
> }

I've encountered it, too.

FWIW, under VC7.1,
Writing 'const T' when T is an array type (eg. boost::is_xxx<const T>::type etc) doesn't work.
But boost::is_xxx<boost::add_const<T>::type>::type works fine.
That's why I always use boost::add_const.

-- 
Regards,
Shunsuke Sogame

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk