Make some constructors constexpr.

This commit is contained in:
levlam 2023-05-21 13:21:49 +03:00
parent d65541d45a
commit f831357538
19 changed files with 19 additions and 19 deletions

View File

@ -21,7 +21,7 @@ class BackgroundId {
public: public:
BackgroundId() = default; BackgroundId() = default;
explicit BackgroundId(int64 background_id) : id(background_id) { explicit constexpr BackgroundId(int64 background_id) : id(background_id) {
} }
template <class T, typename = std::enable_if_t<std::is_convertible<T, int64>::value>> template <class T, typename = std::enable_if_t<std::is_convertible<T, int64>::value>>
BackgroundId(T background_id) = delete; BackgroundId(T background_id) = delete;

View File

@ -20,7 +20,7 @@ class CallId {
public: public:
CallId() = default; CallId() = default;
explicit CallId(int32 call_id) : id(call_id) { explicit constexpr CallId(int32 call_id) : id(call_id) {
} }
template <class T, typename = std::enable_if_t<std::is_convertible<T, int32>::value>> template <class T, typename = std::enable_if_t<std::is_convertible<T, int32>::value>>

View File

@ -25,7 +25,7 @@ class ChannelId {
ChannelId() = default; ChannelId() = default;
explicit ChannelId(int64 channel_id) : id(channel_id) { explicit constexpr ChannelId(int64 channel_id) : id(channel_id) {
} }
template <class T, typename = std::enable_if_t<std::is_convertible<T, int64>::value>> template <class T, typename = std::enable_if_t<std::is_convertible<T, int64>::value>>
ChannelId(T channel_id) = delete; ChannelId(T channel_id) = delete;

View File

@ -24,7 +24,7 @@ class ChatId {
ChatId() = default; ChatId() = default;
explicit ChatId(int64 chat_id) : id(chat_id) { explicit constexpr ChatId(int64 chat_id) : id(chat_id) {
} }
template <class T, typename = std::enable_if_t<std::is_convertible<T, int64>::value>> template <class T, typename = std::enable_if_t<std::is_convertible<T, int64>::value>>
ChatId(T chat_id) = delete; ChatId(T chat_id) = delete;

View File

@ -20,7 +20,7 @@ class CustomEmojiId {
public: public:
CustomEmojiId() = default; CustomEmojiId() = default;
explicit CustomEmojiId(int64 custom_emoji_id) : id(custom_emoji_id) { explicit constexpr CustomEmojiId(int64 custom_emoji_id) : id(custom_emoji_id) {
} }
template <class T, typename = std::enable_if_t<std::is_convertible<T, int64>::value>> template <class T, typename = std::enable_if_t<std::is_convertible<T, int64>::value>>
CustomEmojiId(T custom_emoji_id) = delete; CustomEmojiId(T custom_emoji_id) = delete;

View File

@ -33,7 +33,7 @@ class DialogId {
public: public:
DialogId() = default; DialogId() = default;
explicit DialogId(int64 dialog_id) : id(dialog_id) { explicit constexpr DialogId(int64 dialog_id) : id(dialog_id) {
} }
template <class T, typename = std::enable_if_t<std::is_convertible<T, int64>::value>> template <class T, typename = std::enable_if_t<std::is_convertible<T, int64>::value>>
DialogId(T dialog_id) = delete; DialogId(T dialog_id) = delete;

View File

@ -27,7 +27,7 @@ class DialogListId {
public: public:
DialogListId() = default; DialogListId() = default;
explicit DialogListId(int64 dialog_list_id) : id(dialog_list_id) { explicit constexpr DialogListId(int64 dialog_list_id) : id(dialog_list_id) {
} }
template <class T, typename = std::enable_if_t<std::is_convertible<T, int32>::value>> template <class T, typename = std::enable_if_t<std::is_convertible<T, int32>::value>>
DialogListId(T dialog_list_id) = delete; DialogListId(T dialog_list_id) = delete;

View File

@ -20,7 +20,7 @@ class FolderId {
public: public:
FolderId() = default; FolderId() = default;
explicit FolderId(int32 folder_id) : id(folder_id) { explicit constexpr FolderId(int32 folder_id) : id(folder_id) {
} }
template <class T, typename = std::enable_if_t<std::is_convertible<T, int32>::value>> template <class T, typename = std::enable_if_t<std::is_convertible<T, int32>::value>>
FolderId(T folder_id) = delete; FolderId(T folder_id) = delete;

View File

@ -18,7 +18,7 @@ class GroupCallId {
public: public:
GroupCallId() = default; GroupCallId() = default;
explicit GroupCallId(int32 group_call_id) : id(group_call_id) { explicit constexpr GroupCallId(int32 group_call_id) : id(group_call_id) {
} }
template <class T, typename = std::enable_if_t<std::is_convertible<T, int32>::value>> template <class T, typename = std::enable_if_t<std::is_convertible<T, int32>::value>>

View File

@ -22,7 +22,7 @@ class InputDialogId {
public: public:
InputDialogId() = default; InputDialogId() = default;
explicit InputDialogId(DialogId dialog_id) : dialog_id(dialog_id) { explicit constexpr InputDialogId(DialogId dialog_id) : dialog_id(dialog_id) {
} }
explicit InputDialogId(const tl_object_ptr<telegram_api::InputPeer> &input_peer); explicit InputDialogId(const tl_object_ptr<telegram_api::InputPeer> &input_peer);

View File

@ -18,7 +18,7 @@ class NotificationGroupId {
public: public:
NotificationGroupId() = default; NotificationGroupId() = default;
explicit NotificationGroupId(int32 group_id) : id(group_id) { explicit constexpr NotificationGroupId(int32 group_id) : id(group_id) {
} }
template <class T, typename = std::enable_if_t<std::is_convertible<T, int32>::value>> template <class T, typename = std::enable_if_t<std::is_convertible<T, int32>::value>>

View File

@ -20,7 +20,7 @@ class PollId {
public: public:
PollId() = default; PollId() = default;
explicit PollId(int64 poll_id) : id(poll_id) { explicit constexpr PollId(int64 poll_id) : id(poll_id) {
} }
template <class T, typename = std::enable_if_t<std::is_convertible<T, int64>::value>> template <class T, typename = std::enable_if_t<std::is_convertible<T, int64>::value>>
PollId(T poll_id) = delete; PollId(T poll_id) = delete;

View File

@ -20,7 +20,7 @@ class ScheduledServerMessageId {
public: public:
ScheduledServerMessageId() = default; ScheduledServerMessageId() = default;
explicit ScheduledServerMessageId(int32 message_id) : id(message_id) { explicit constexpr ScheduledServerMessageId(int32 message_id) : id(message_id) {
} }
template <class T, typename = std::enable_if_t<std::is_convertible<T, int32>::value>> template <class T, typename = std::enable_if_t<std::is_convertible<T, int32>::value>>
ScheduledServerMessageId(T message_id) = delete; ScheduledServerMessageId(T message_id) = delete;

View File

@ -22,7 +22,7 @@ class SecretChatId {
public: public:
SecretChatId() = default; SecretChatId() = default;
explicit SecretChatId(int32 chat_id) : id(chat_id) { explicit constexpr SecretChatId(int32 chat_id) : id(chat_id) {
} }
template <class T, typename = std::enable_if_t<std::is_convertible<T, int32>::value>> template <class T, typename = std::enable_if_t<std::is_convertible<T, int32>::value>>
SecretChatId(T chat_id) = delete; SecretChatId(T chat_id) = delete;

View File

@ -18,7 +18,7 @@ class ServerMessageId {
public: public:
ServerMessageId() = default; ServerMessageId() = default;
explicit ServerMessageId(int32 message_id) : id(message_id) { explicit constexpr ServerMessageId(int32 message_id) : id(message_id) {
} }
template <class T, typename = std::enable_if_t<std::is_convertible<T, int32>::value>> template <class T, typename = std::enable_if_t<std::is_convertible<T, int32>::value>>
ServerMessageId(T message_id) = delete; ServerMessageId(T message_id) = delete;

View File

@ -24,7 +24,7 @@ class UserId {
UserId() = default; UserId() = default;
explicit UserId(int64 user_id) : id(user_id) { explicit constexpr UserId(int64 user_id) : id(user_id) {
} }
template <class T, typename = std::enable_if_t<std::is_convertible<T, int64>::value>> template <class T, typename = std::enable_if_t<std::is_convertible<T, int64>::value>>
UserId(T user_id) = delete; UserId(T user_id) = delete;

View File

@ -21,7 +21,7 @@ class WebPageId {
public: public:
WebPageId() = default; WebPageId() = default;
explicit WebPageId(int64 web_page_id) : id(web_page_id) { explicit constexpr WebPageId(int64 web_page_id) : id(web_page_id) {
} }
template <class T, typename = std::enable_if_t<std::is_convertible<T, int64>::value>> template <class T, typename = std::enable_if_t<std::is_convertible<T, int64>::value>>
WebPageId(T web_page_id) = delete; WebPageId(T web_page_id) = delete;

View File

@ -19,7 +19,7 @@ class FileDbId {
public: public:
FileDbId() = default; FileDbId() = default;
explicit FileDbId(uint64 file_db_id) : id(file_db_id) { explicit constexpr FileDbId(uint64 file_db_id) : id(file_db_id) {
} }
template <class T1, typename = std::enable_if_t<std::is_convertible<T1, uint64>::value>> template <class T1, typename = std::enable_if_t<std::is_convertible<T1, uint64>::value>>
FileDbId(T1 file_db_id) = delete; FileDbId(T1 file_db_id) = delete;

View File

@ -20,7 +20,7 @@ class FileSourceId {
public: public:
FileSourceId() = default; FileSourceId() = default;
explicit FileSourceId(int32 file_source_id) : id(file_source_id) { explicit constexpr FileSourceId(int32 file_source_id) : id(file_source_id) {
} }
template <class T1, typename = std::enable_if_t<std::is_convertible<T1, int32>::value>> template <class T1, typename = std::enable_if_t<std::is_convertible<T1, int32>::value>>
FileSourceId(T1 file_source_id) = delete; FileSourceId(T1 file_source_id) = delete;