Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Commits
8d9a468b
Commit
8d9a468b
authored
3 years ago
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Modernize a bit the code using is_const_v
parent
ba56a8dd
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!103
Set AssertError to inherit from std::runtime_error
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/utils/Array.hpp
+2
-2
2 additions, 2 deletions
src/utils/Array.hpp
with
2 additions
and
2 deletions
src/utils/Array.hpp
+
2
−
2
View file @
8d9a468b
...
@@ -60,7 +60,7 @@ class [[nodiscard]] Array
...
@@ -60,7 +60,7 @@ class [[nodiscard]] Array
PUGS_INLINE
PUGS_INLINE
void
fill
(
const
DataType
&
data
)
const
void
fill
(
const
DataType
&
data
)
const
{
{
static_assert
(
not
std
::
is_const
<
DataType
>
()
,
"Cannot modify Array of const"
);
static_assert
(
not
std
::
is_const
_v
<
DataType
>
,
"Cannot modify Array of const"
);
Kokkos
::
deep_copy
(
m_values
,
data
);
Kokkos
::
deep_copy
(
m_values
,
data
);
}
}
...
@@ -72,7 +72,7 @@ class [[nodiscard]] Array
...
@@ -72,7 +72,7 @@ class [[nodiscard]] Array
static_assert
(
std
::
is_same
<
std
::
remove_const_t
<
DataType
>
,
std
::
remove_const_t
<
DataType2
>>
(),
static_assert
(
std
::
is_same
<
std
::
remove_const_t
<
DataType
>
,
std
::
remove_const_t
<
DataType2
>>
(),
"Cannot assign Array of different type"
);
"Cannot assign Array of different type"
);
// ensures that const is not lost through copy
// ensures that const is not lost through copy
static_assert
(((
std
::
is_const
<
DataType2
>
()
and
std
::
is_const
<
DataType
>
()
)
or
not
std
::
is_const
<
DataType2
>
()
),
static_assert
(((
std
::
is_const
_v
<
DataType2
>
and
std
::
is_const
_v
<
DataType
>
)
or
not
std
::
is_const
_v
<
DataType2
>
),
"Cannot assign Array of const to Array of non-const"
);
"Cannot assign Array of const to Array of non-const"
);
m_values
=
array
.
m_values
;
m_values
=
array
.
m_values
;
return
*
this
;
return
*
this
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment