Boost Users :
Subject: [Boost-users] [MPL][MP11] Return value of at_c for out of range index
From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2019-03-04 21:41:33
While porting some code from MPL to MP11, the latter helped to find some
bugs in the ported code 
I looked closer at those and found 'behavioural' differences between
MPL and MP11
when accessing sequences with index value that is out of range.
Could anyone help me to understand the following?
1. Why this compiles?
using R = at_c<range_c<int, 0, 1>, 100>::type;
Tested in C++11 using GCC, clang, MSVC from VS2017/2019
2. Why this compiles in GCC and clang, but fails with MSVC?
using V = at_c<vector3_c<unsigned, 1, 2, 3>, 100>::type::type;
3. For GCC and clang, why this compiles
static_assert(std::is_same<R, integral_c<int, 100>>::value, "");
but this fails?
static_assert(std::is_same<V, integral_c<unsigned int, 100>>::value, "");
Don't vector_c and range_c yield equivalent sequences?
By the way, MP11's mp_at_c yield void, as expected, there also
no ::type or ::value member, so diagnostics is clearer.
-- Mateusz Loskot, http://mateusz.loskot.net
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