microsoft / cpprestsdk

The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
Other
7.96k stars 1.65k forks source link

Missing operators and ctors for http_request and http_response #1668

Open evilenzo opened 2 years ago

evilenzo commented 2 years ago

Solves this issue: https://github.com/microsoft/cpprestsdk/issues/1667

barcharcraz commented 2 years ago

This approach seems completely backwards, for starters it adds a bunch of (implicit) copy constructors and that's totally not necessary, and also, the new move constructor doesn't move!

It would be much better to stop defining an empty destructor (which is equivalent to what the compiler would do anyways) and just default the move constructor, so the shared pointer would get moved

evilenzo commented 2 years ago

Ok. My point was to implement all functions of rule of five to not be aware if compiler won't generate move/copy ctors and assignment operators. If we wan't to produce less redunant code, we must follow standard which says that compiler will generate both copy and assignment functions if we doesn't have user-defined destructor. The main problem is this line. User-defined destructor means that compiler won't support us

evilenzo commented 2 years ago

Also this file has other ctors and dtors that are defaulted. If it is the matter of style so why we won't change them to {} too?