|
Boost Users : |
Subject: Re: [Boost-users] BOOST_STATIC_ASSERT with boost::array.static_size
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2013-07-12 05:07:58
2013/7/11 Anton Daneyko <self_at_[hidden]>
> Dear boost users, could someone tell me why this short program does not
> compile?
>
> #include <boost/array.hpp>
> #include <boost/static_assert.hpp>
>
> int main(int argc, const char *argv[])
> {
> boost::array<int, 3> a1 = {{1, 1, 1}};
> BOOST_STATIC_ASSERT(a1.static_size == 3);
> return 0;
> }
>
You must write BOOST_STATIC_ASSERT(boost::array<int, 3>::static_size == 3);
Here is a fixed version:
#include <boost/array.hpp>
#include <boost/static_assert.hpp>
int main(int argc, const char *argv[])
{
typedef boost::array<int, 3> array_t;
array_t a1 = {{1, 1, 1}};
BOOST_STATIC_ASSERT(array_t::static_size == 3);
return 0;
}
-- Best regards, Antony Polukhin
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