Created
June 25, 2016 21:44
-
-
Save ricejasonf/0ebb7ea19f303b7d7af1224c4c9781c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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