1

In the following function:

namespace hana = boost::hana;

template<typename T>
constexpr auto f(const T& obj){
    constexpr int size = hana::length(obj);
}

When called e.g. with f(hana::make_tuple()), it produces an error:

constexpr variable 'size' must be initialized by a constant expression.

Passing by value doesn't have issues.

Does anyone know the reason and how to work around it?

Jan Schultke
  • 17,446
  • 6
  • 47
  • 96
Mario Demontis
  • 469
  • 3
  • 11

0 Answers0