-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add literals for size_t and ptrdiff_t
- Loading branch information
1 parent
4b929df
commit 0d9cbf6
Showing
2 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (C) 2024 Albin Johansson (GNU General Public License v3.0) | ||
|
||
#pragma once | ||
|
||
#include <cstddef> // size_t, ptrdiff_t | ||
|
||
namespace tactile { | ||
|
||
[[nodiscard]] | ||
consteval auto operator""_uz(const unsigned long long int value) noexcept -> std::size_t | ||
{ | ||
return static_cast<std::size_t>(value); | ||
} | ||
|
||
[[nodiscard]] | ||
consteval auto operator""_z(const unsigned long long int value) noexcept -> std::ptrdiff_t | ||
{ | ||
return static_cast<std::ptrdiff_t>(value); | ||
} | ||
|
||
} // namespace tactile |