Boost logo

Boost Users :

From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2020-06-18 22:39:17


On Thu, 18 Jun 2020 at 19:10, Debabrata Mandal via Boost-users
<boost-users_at_[hidden]> wrote:
>
> Now, fast forwarding to my problem, I want to be able to provide a sub-histogram based on a few axes of the histogram. The code below, quite similar to what I want, refuses to work with msvc-14.0 (coming to it shortly).
>
> ----Sample Code----
> #include <boost/mp11.hpp>
> template<typename... T>
> struct histogram {
> using type_list = boost::mp11::mp_list<T...>;
> template<std::size_t... D>
> void d() {
> // Error in below line
> histogram<boost::mp11::mp_at_c<type_list, D>...> f;
> }
> };
> int main() {
> histogram<int, int, int, int> f;
> f.d<1,2>();
> return 0;
> }
> ---END---
>
> So, msvc-14.0 gives the error (after tracing to the last function call in stack) at the position specified above. The error message which is coming from the AppVeyor logs (since I do not have msvc-14.0)
> ...
> C:\projects\boost-root\boost/mp11/utility.hpp(53): error C2971: 'boost::mp11::detail::mp_if_c_impl': template parameter 'C': 'C': a variable with non-static storage duration cannot be used as a non-type argument
> C:\projects\boost-root\boost/mp11/utility.hpp(38): note: see declaration of 'boost::mp11::detail::mp_if_c_impl'
> C:\projects\boost-root\boost/gil/histogram.hpp(247): note: see declaration of 'C'
> ...
>
> I am not sure if the issue is with mp11 or the msvc-14.0,

For the archive, I'm copying answer from Peter received on the Slack's
#boost-user

msvc 2015 bug
use
        histogram<boost::mp11::mp_at<type_list,
boost::mp11::mp_size_t<D>>...> f;
instead

Best regards,

-- 
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