Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Pour information : coupure de la forge ce matin entre 6h45 et 7h05 pour une mise à jour de sécurité
Open sidebar
Gauthier Quesnel
irritator
Commits
fd5aa4a3
Commit
fd5aa4a3
authored
May 20, 2021
by
Gauthier Quesnel
Browse files
core: move usefull template function
parent
9105491f
Pipeline
#33344
passed with stage
in 1 minute and 14 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
app/gui/node-editor.hpp
View file @
fd5aa4a3
...
...
@@ -93,33 +93,6 @@ status_string(const status s) noexcept
return
str
[
static_cast
<
int
>
(
s
)];
}
template
<
class
C
>
constexpr
int
length
(
const
C
&
c
)
noexcept
{
return
static_cast
<
int
>
(
c
.
size
());
}
template
<
class
T
,
size_t
N
>
constexpr
int
length
(
const
T
(
&
array
)[
N
])
noexcept
{
(
void
)
array
;
return
static_cast
<
int
>
(
N
);
}
template
<
typename
Identifier
>
constexpr
Identifier
undefined
()
noexcept
{
static_assert
(
std
::
is_enum
<
Identifier
>::
value
,
"Identifier must be a enumeration: enum class id : unsigned {};"
);
return
static_cast
<
Identifier
>
(
0
);
}
enum
class
editor_id
:
u64
;
enum
class
cluster_id
:
u64
;
...
...
lib/include/irritator/core.hpp
View file @
fd5aa4a3
...
...
@@ -138,6 +138,33 @@ to_unsigned(Integer value)
return
static_cast
<
typename
std
::
make_unsigned
<
Integer
>::
type
>
(
value
);
}
template
<
class
C
>
constexpr
int
length
(
const
C
&
c
)
noexcept
{
return
static_cast
<
int
>
(
c
.
size
());
}
template
<
class
T
,
size_t
N
>
constexpr
int
length
(
const
T
(
&
array
)[
N
])
noexcept
{
(
void
)
array
;
return
static_cast
<
int
>
(
N
);
}
template
<
typename
Identifier
>
constexpr
Identifier
undefined
()
noexcept
{
static_assert
(
std
::
is_enum
<
Identifier
>::
value
,
"Identifier must be a enumeration: enum class id : unsigned {};"
);
return
static_cast
<
Identifier
>
(
0
);
}
/*****************************************************************************
*
* Return status of many function
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment