Skip to content

Instantly share code, notes, and snippets.

@guilhermeleobas
Created June 23, 2021 23:52
Show Gist options
  • Select an option

  • Save guilhermeleobas/10dfc45b2f87f8ccf6c63a63b95289af to your computer and use it in GitHub Desktop.

Select an option

Save guilhermeleobas/10dfc45b2f87f8ccf6c63a63b95289af to your computer and use it in GitHub Desktop.
#define BOOST_STRONG_TYPEDEF(T, D) \
struct TextEncodingDict { \
T t; \
D(const T t_) : t(t_){}; \
D(){}; \
D(const D& t_) : t(t_.t) {} \
D& operator=(const D& rhs) { \
t = rhs.t; \
return *this; \
} \
D& operator=(const T& rhs) { \
t = rhs; \
return *this; \
} \
operator T() const { return t; } \
operator T&() { return t; } \
bool operator==(const D& rhs) const { return t == rhs.t; } \
bool operator<(const D& rhs) const { return t < rhs.t; } \
};
BOOST_STRONG_TYPEDEF(int32_t, TextEncodingDict)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment