move confirmation_callback_t constructors out of line and fix move semantics - #1620
move confirmation_callback_t constructors out of line and fix move semantics#1620erics118 wants to merge 5 commits into
Conversation
declare special member functions out of line, so codegen is emitted once rather than in every tu
declare special members out of line for large objects (message, embed, component, user, channel, guild, slashcommand, interaction, command_option)
for json_interface only types (ban, invite, prune, dtemplate, voiceregion, voicestate, auditlog, guild_command_permissions, onboarding, application_role_connection and its nested metadata, automod_metadata) virtual destructor has to stay, and we declare rule of 5 to ensure proper move semantics for managed types, (application, integration, stage_instance, sticker, user_identified, automod_rule) the declared destructor is redundant, so we remove it, so it supports proper move semantics now, confirmation_callback_t is known to be nothrow moveable
✅ Deploy Preview for dpp-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
…l member functions inline
msvc computes noexcept(false) always, so this would be incorrect on msvc no change for all others
braindigitalis
left a comment
There was a problem hiding this comment.
needs comments, and we can't really just get rid of the destructors as it breaks the expectations of the managed base class.
| interaction_response() = default; | ||
| interaction_response(const interaction_response&); | ||
| interaction_response(interaction_response&&); | ||
| interaction_response& operator=(const interaction_response&); |
There was a problem hiding this comment.
documentation needed
| */ | ||
| interaction(); | ||
|
|
||
| interaction(const interaction&) = default; |
There was a problem hiding this comment.
documentation needed
| @@ -1415,6 +1429,11 @@ class DPP_EXPORT guild_command_permissions : public json_interface<guild_command | |||
| */ | |||
| guild_command_permissions(); | |||
|
|
|||
There was a problem hiding this comment.
documentation needed
| */ | ||
| slashcommand(const std::string &_name, const slashcommand_contextmenu_type _type, const dpp::snowflake _application_id); | ||
|
|
||
| slashcommand(const slashcommand&) = default; |
There was a problem hiding this comment.
documentation needed
| */ | ||
| automod_metadata(); | ||
|
|
||
| automod_metadata(const automod_metadata&) = default; |
There was a problem hiding this comment.
documentation needed
| /** Constructor */ | ||
| ban(); | ||
|
|
||
| ban(const ban&) = default; |
There was a problem hiding this comment.
documentation needed
| integration(); | ||
|
|
||
| /** Default destructor */ | ||
| ~integration() = default; |
There was a problem hiding this comment.
if it is managed a user could choose to put it in a cache. without the virtual dtor, that becomes ub.
| */ | ||
| sticker(); | ||
|
|
||
| virtual ~sticker() = default; |
There was a problem hiding this comment.
same here user could choose to cache it with a custom cache. that's the point of managed
| public: | ||
| prune() = default; | ||
|
|
||
| prune(const prune&) = default; |
There was a problem hiding this comment.
documentation needed
| confirmation_callback_t() = default; | ||
| confirmation_callback_t(); | ||
|
|
||
| confirmation_callback_t(const confirmation_callback_t&); |
There was a problem hiding this comment.
documentation needed
we fix move semantics for two types of classes:
json_interface only types: (ban, invite, prune, dtemplate, voiceregion, voicestate, auditlog, guild_command_permissions, onboarding, application_role_connection and its nested metadata, automod_metadata)
proper move semantics
managed types: (application, integration, stage_instance, sticker, user_identified, automod_rule)
confirmation_callback_t special member functions are moved out of line so codegen is emitted once rather than in every translation unit, saving compile time (for ppl using the library, no big change to DPP compile times)
similarly, we also move special member functions for message, embed, component, user, channel, guild, slashcommand, interaction, command_option out of line to also save compile time
Code change checklist