struct mystruct
{
using this_class = mystruct;
/*
old typedef such as:
typedef struct mystruct this_class;
also does not work
*/
this_class(){}
};
This code works well in visual C++, but fails in gcc or clang. I suspect it may not be 100% C++ even with c++11, c++14 or c++17 switches.
But it is very useful to have a this_class
typedef because it permits to change the name of a class by simply adjusting
using this_class = new_class_name
without having to change all the occurrences of the class name in the class definition.
Is there a switch in gcc and clang that would allow me to continue to use this useful statement (allowed in visual c) when I port my code from visual c++ ?
NOTE: This differs from a previous question: 'Can I implement an autonomous self
member type in C++? ' as I want to know if there are switches in clang and gcc to allow the above statement allowed in visual c++. I am not interested in the complicated hacks shows in the other question, just on compatibility switches between compilers