These are chat archives for boostorg/hana

1st
Mar 2018
Jason Rice
@ricejasonf
Mar 01 2018 22:39
I just encountered a scenario where not having typename changed caused sfinae to squelch an error.
#include <boost/hana.hpp>
#include <array>
#include <string>
#include <type_traits>

namespace hana = boost::hana;

int main() {
  auto is_byte_container = hana::is_valid([](auto&& x)
    -> std::enable_if_t<(sizeof(typename std::decay_t<decltype(x)>::value_type) == 1)>
                             // ^ don't forget typename or its not valid
  { return {}; });

  static_assert(decltype(is_byte_container(std::string{})){});
  static_assert(decltype(is_byte_container(std::array<unsigned char, 42>{})){});
}
everything was fine, but the static_asserts were failing
something about sizeof, but I don't get it