mirror of
https://github.com/boostorg/hana.git
synced 2026-02-10 11:32:26 +00:00
Core: make default_instance dependent on the type class arguments
This commit is contained in:
@@ -16,21 +16,19 @@ namespace hana = boost::hana;
|
||||
struct Showable {
|
||||
BOOST_HANA_TYPECLASS(Showable);
|
||||
struct mcd { };
|
||||
|
||||
template <typename T>
|
||||
struct default_instance : mcd {
|
||||
template <typename X>
|
||||
static std::string show_impl(X)
|
||||
{ return "<?>"; }
|
||||
};
|
||||
};
|
||||
|
||||
BOOST_HANA_CONSTEXPR_LAMBDA auto show = [](auto x) {
|
||||
return Showable::instance<hana::datatype_t<decltype(x)>>::show_impl(x);
|
||||
};
|
||||
|
||||
namespace boost { namespace hana {
|
||||
template <>
|
||||
struct default_instance<Showable> : Showable::mcd {
|
||||
template <typename X>
|
||||
static std::string show_impl(X)
|
||||
{ return "<?>"; }
|
||||
};
|
||||
}}
|
||||
|
||||
template <>
|
||||
struct Showable::instance<int> : Showable::mcd {
|
||||
static auto show_impl(int i)
|
||||
|
||||
Reference in New Issue
Block a user