Category : c++17

I have the following example with std::variant usage: #include <iostream> #include <string> #include <variant> class Cat { public: const std::string& getSound() const { return sound; }; private: std::string sound = "Meow."; }; class Dog { public: const std::string getSound() const { return sound; }; private: std::string sound = "Bark."; }; class House { public: void ..

Read more

Is it a MinGW bug or an expected behavior? This version compiles: template<typename T> constexpr auto get_foo(T &t) { return t.foo(); } template<typename Impl> class dummy { public: dummy() { [[maybe_unused]] auto &&foo = get_foo(impl_); } private: Impl impl_; }; struct Foo{}; using TupleFoo = std::tuple<Foo>; Foo &get_foo(TupleFoo &tuple) { return std::get<Foo>(tuple); } int main(int, ..

Read more