C++:MemberFunctions
Special member functions
Special member functions are the only functions that can be defaulted, that is, defined using = default
instead of the function body (see their pages for details)
struct AmRequestEvent
{
int32_t id = 0;
int32_t type = 0;
std::vector<AmPoint> points;
std::vector<int32_t> extras;
AmRequestEvent() = default;
AmRequestEvent(AmRequestEvent const & obj) = default;
AmRequestEvent(AmRequestEvent && obj) = default;
AmRequestEvent & operator =(AmRequestEvent const & obj) = default;
AmRequestEvent & operator =(AmRequestEvent && obj) = default;
};
Default constructor
Copy constructor
Move constructor (since C++11)
Copy assignment operator
Move assignment operator (since C++11)
Destructor
Troubleshooting
request for member '..' in '..' which is of non-class type
- error: request for member '..' in '..' which is of non-class type
- [Duplicate]
request for member “…” in “…” which is of non-class type “…”
change to
You get the error because compiler thinks of
as of function declaration with name 'foo2' and the return type 'Foo'.