strongdef: actually use tagging for disambiguation...
This commit is contained in:
parent
37268d6215
commit
99d025af4d
@ -23,4 +23,4 @@ using util::strongdef;
|
|||||||
// This instantiation is not meant to be exported, only being used as a local
|
// This instantiation is not meant to be exported, only being used as a local
|
||||||
// compilation error canary.
|
// compilation error canary.
|
||||||
|
|
||||||
template struct util::strongdef<unsigned>;
|
template struct util::strongdef<unsigned,void>;
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
namespace util {
|
namespace util {
|
||||||
/// A transparent wrapper around a (typically lightweight) type for the
|
/// A transparent wrapper around a (typically lightweight) type for the
|
||||||
/// purposes of overload disambiguation. It acts like a typesafe typedef.
|
/// purposes of overload disambiguation. It acts like a typesafe typedef.
|
||||||
template <typename T>
|
template <typename T,typename Tag>
|
||||||
struct strongdef {
|
struct strongdef {
|
||||||
public:
|
public:
|
||||||
using value_type = T;
|
using value_type = T;
|
||||||
@ -45,9 +45,9 @@ namespace util {
|
|||||||
|
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
template <typename T>
|
template <typename T, typename Tag>
|
||||||
struct numeric_limits<util::strongdef<T>> {
|
struct numeric_limits<util::strongdef<T,Tag>> {
|
||||||
using value_type = typename util::strongdef<T>::value_type;
|
using value_type = typename util::strongdef<T,Tag>::value_type;
|
||||||
|
|
||||||
static constexpr bool is_specialized = numeric_limits<value_type>::is_specialized;
|
static constexpr bool is_specialized = numeric_limits<value_type>::is_specialized;
|
||||||
static constexpr bool is_signed = numeric_limits<value_type>::is_signed;
|
static constexpr bool is_signed = numeric_limits<value_type>::is_signed;
|
||||||
|
@ -10,7 +10,7 @@ main (void)
|
|||||||
util::TAP::logger tap;
|
util::TAP::logger tap;
|
||||||
|
|
||||||
// These tests are less about functional testing, and more about link testing.
|
// These tests are less about functional testing, and more about link testing.
|
||||||
strongdef<unsigned> fortytwo (42u);
|
strongdef<unsigned,void> fortytwo (42u);
|
||||||
tap.expect_eq (fortytwo.data, 42u, "raw data equality");
|
tap.expect_eq (fortytwo.data, 42u, "raw data equality");
|
||||||
tap.expect_eq (fortytwo, 42u, "passthrough equality");
|
tap.expect_eq (fortytwo, 42u, "passthrough equality");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user