Boost logo

Boost :

Subject: Re: [boost] [mpl] Problem with VC++14 and boost::mpl::size_t
From: Edward Diener (eldiener_at_[hidden])
Date: 2015-07-26 11:16:22


On 7/26/2015 11:00 AM, Peter Dimov wrote:
>> My money is on #include <boost/config.hpp>, because
>> lightweight_test.hpp doesn't do much else involving size_t. Or perhaps
>> it's the #include <iostream> that pulls something in?
>
> It's <iostream>. Which is better as now the bug report is
> self-contained. :-)

Yes.

#include <cstddef>
#include <iostream>
namespace boost { namespace mpl {
struct integral_c_tag { static const int value = 0; };
template< std::size_t N >
struct size_t
{
     static const std::size_t value = N;
     typedef size_t type;
     typedef std::size_t value_type;
     typedef integral_c_tag tag;
     typedef boost::mpl::size_t< static_cast<std::size_t>((value + 1)) >
next;
     typedef boost::mpl::size_t< static_cast<std::size_t>((value - 1)) >
prior;
     operator std::size_t() const { return
static_cast<std::size_t>(this->value); }
};
template< std::size_t N >
std::size_t const boost::mpl::size_t< N >::value;
}}

int main()
{
     return 0;
}
using namespace boost;
using namespace mpl;

The above fails, nor does the order of the two #includes affect
anything. Removing the using directives at the end and it succeeds. I
will report this directly to Microsoft. Maybe STL can get them to
address this bug. The code is a much simplified version of the MPL tests
using boost::mpl::size_t.


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