Displaying 1 result from an estimated 1 matches for "strongtypedef".
2019 Aug 01
5
RFC: Strong typedef for LLVM
...oo(arg1, Flag1Value(true), Flag2Value(false));
foo(arg1, Flag2Value(true), Flag1Value(false)); // Won't compile.
Of course, defining individual classes for every kind of flag does not
scale. However, a template class can make it workable:
template<typename Tag, typename T>
class StrongTypedef {
public:
using BaseType = T;
private:
BaseType Value;
public:
constexpr StrongTypedef() : Value() {}
constexpr StrongTypedef(const StrongTypedef<Tag, T> &) = default;
explicit constexpr StrongTypedef(const BaseType &V) : Value(V) {}
explicit StrongType...