Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-matrix-vector
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
apminaei
dune-matrix-vector
Commits
14796027
Commit
14796027
authored
7 years ago
by
Max Kahnt
Browse files
Options
Downloads
Patches
Plain Diff
Add todos for convenient resize compiler errors.
parent
301d1375
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/matrix-vector/genericvectortools.hh
+7
-1
7 additions, 1 deletion
dune/matrix-vector/genericvectortools.hh
with
7 additions
and
1 deletion
dune/matrix-vector/genericvectortools.hh
+
7
−
1
View file @
14796027
...
...
@@ -48,6 +48,7 @@ void truncate(Vector& v, const BitVector& tr) {
}
//! Resize vector recursively to size of given vector/matrix
// EXPERIMENTAL: Its implementation is still subject to change.
// Note: We need the rvalue reference here, because we might obtain a
// temporary recursively, e.g. in std::bitset the operator[] yields a
// std::bitset::reference temporary due to its specific implementation.
...
...
@@ -114,11 +115,13 @@ auto getSize(const SizeProvider& sizeProvider) {
}
/// compile-time helper traits
// TODO these are not satifsying, because e.g. for custom matrices that
// do not specialiaze the MatrixTraits properly, the error messages are
// not very helpful. In particular they may trigger a misleading static_assert.
template
<
class
M
>
constexpr
auto
isMatrix
()
{
return
Std
::
bool_constant
<
MatrixTraits
<
M
>::
isMatrix
>
();
}
template
<
class
V
>
constexpr
auto
isVector
()
{
// Note: At the time this comment is written, the only use of
...
...
@@ -156,6 +159,8 @@ struct ScalarSwitch<Vector,
// vector to be resized.
template
<
class
Resizeable
>
static
void
resize
(
Resizeable
&
v
,
const
Vector
&
sizeProvider
)
{
// TODO this assert may also be triggered when isMatrix/isVector do not
// work properly, e.g. due to a missing MatrixTraits specialization.
static_assert
(
not
IsNumber
<
Resizeable
>::
value
,
"SizeProvider seems to have nesting depth that is not applicable to given vector type."
);
using
namespace
Hybrid
;
...
...
@@ -208,6 +213,7 @@ protected:
// priority tag forward helper
template
<
class
SizeProviderRow
>
static
decltype
(
auto
)
subSizeProvider
(
SizeProviderRow
&&
row
)
{
// TODO add static assert that fails or warns if subSizeProvider is not a matrix for a matrix or a vector for a vector
return
This
::
subSizeProvider
(
std
::
forward
<
SizeProviderRow
>
(
row
),
PriorityTag
<
42
>
());
}
};
...
...
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