Skip to content

Instantly share code, notes, and snippets.

@ricejasonf
Created June 25, 2016 21:44
Show Gist options
  • Save ricejasonf/0ebb7ea19f303b7d7af1224c4c9781c2 to your computer and use it in GitHub Desktop.
Save ricejasonf/0ebb7ea19f303b7d7af1224c4c9781c2 to your computer and use it in GitHub Desktop.
#include<boost/hana.hpp>
namespace hana = boost::hana;
struct a_tag { };
struct b_tag { };
template <typename T>
constexpr auto get(T)
{
if constexpr(T::value < 5)
return hana::type_c<a_tag>;
else
return hana::type_c<b_tag>;
}
int main()
{
static_assert(get(hana::int_c<0>) == hana::type_c<a_tag>);
static_assert(get(hana::int_c<5>) == hana::type_c<b_tag>);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment