Boost logo

Boost Users :

Subject: Re: [Boost-users] MSVC++ 2010 and BOOST_STATIC_ASSERT
From: Nathan Crookston (nathan.crookston_at_[hidden])
Date: 2011-11-02 01:42:07


Hi Thomas,

On Tue, Nov 1, 2011 at 11:24 PM, Sunil Thomas <sgthomas27_at_[hidden]> wrote:
> The condensed code that generates the error in the last e-mail is as
> follows:
<snip code>
> I realize that N defaults to 3 and all, but without making any sweeping
> changes, is there a way to force MSVC++ 2010 to just compile, considering
> this was compiling fine with MSVC++ 2008?

Your code (with fairly simple modifications) worked fine for me in
VC10 and g++4.X:

#include <boost/static_assert.hpp>

//Added typedef and 'class' keyword below.
typedef int some_type;
template<typename T = some_type, std::size_t N=3> class my_class {
     public:
         my_class(const T& i0) {
              BOOST_STATIC_ASSERT(N==1);
              m_data[0]=i0;
         }
     private:
         T m_data[N];
};

I suspect the error you're seeing might depend on how you instantiate
my_class -- as Steven said, more context is necessary. If you can
post a compilable example that exhibits the problem our advice will
likely be more helpful.

Nate


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net