Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // clang++ -std=c++14 -O0 -g -Wall -fcolor-diagnostics main.cpp
- #include <string>
- template <int tag> class string_wrapper final {
- public:
- explicit string_wrapper(std::string str) : value_(std::move(str)) {}
- const std::string &str() const noexcept { return value_; }
- private:
- std::string value_;
- };
- enum type_tags { a, b, c };
- using type_a = string_wrapper<a>;
- using type_b = string_wrapper<b>;
- using type_c = string_wrapper<c>;
- int main() {
- auto some_a = type_a("some a");
- auto some_b = type_b("some b");
- auto some_c = type_c("some c");
- some_a = some_c; // Does not compile! Check error message
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement