Hi,
I am trying to implement a histogram class that will be able to store
tuples of any data type. Most likely, I chose std::tuple for the job. So,
in brief I used std::tuple as the key type in an unordered_map. I used
boost::hash_value to supply the hasher in place of std::hash in the third
template argument to unordered_map.
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
template
struct histogram {
using type_list = boost::mp11::mp_list;
template
void d() {
// Error in below line
histogram...> f;
}
};
int main() {
histogram 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, but I did find
some references which claim a similar issue with the latter case.
This links
https://developercommunity.visualstudio.com/content/problem/719235/erroneous...
to a very similar case of the error C2971 which seems to be fixed in the
future releases. Also, the code above compiles fine with GCC and Clang.
Any comments or suggestions on this are most welcome.
Thanks, Deb
GSOC 2020 student in Boost.GIL