|
Boost Users : |
Subject: Re: [Boost-users] MSVC++ 2010 and BOOST_STATIC_ASSERT
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2011-11-02 12:51:51
AMDG
On 11/01/2011 10:24 PM, Sunil Thomas wrote:
> The condensed code that generates the error in the last e-mail is as
> follows:
>
> template<typename T = some_type, std::size_t N=3> my_class {
> public:
> my_class(const T& i0) {
> BOOST_STATIC_ASSERT(N==1);
> m_data[0]=i0;
> }
> private:
> T m_data[N];
> }
>
> 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?
>
The following code compiles fine with MSVC 2010.
#include <cstddef>
#include <boost/static_assert.hpp>
template<class T = int, std::size_t N = 3>
class C {
public:
C() {}
C(const T& i0) {
BOOST_STATIC_ASSERT(N == 1);
m_data[0] = i0;
}
private:
T m_data[N];
};
int main() {
C<> c;
}
Can you provide a minimal *complete* test
case that fails?
In Christ,
Steven Watanabe
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