
On Thu, Jan 10, 2013 at 11:16 PM, Marshall Clow <mclow.lists@gmail.com> wrote:
On Jan 10, 2013, at 9:06 AM, Vicente J. Botet Escriba <vicente.botet@wanadoo.fr> wrote:
Here's my test case (using a locally modified Boost::Array): constexpr boost::array<int, 10> arr_std {{ 0,1,2,3,4,5,6,7,8,9 }}; int whatever [ arr.at(4) ];
FWIW, with gcc array size doesn't seem to have to be a constant expression. The following terminates because of throwing an exception: template< typename T, unsigned int n > struct array { constexpr array() {} constexpr T at(unsigned int i) const { return i < n ? T() : throw 0; } }; int main(int, char*[]) { constexpr array< int, 5 > arr; int whatever[arr.at(10)]; return whatever[0]; }