Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-xt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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
Service Desk
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
ag-ohlberger
dune-community
dune-xt
Commits
3eb4506e
Commit
3eb4506e
authored
4 years ago
by
René Fritze
Committed by
René Fritze
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[fixed_map] simplify range_error_message
parent
b2b4ca26
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!31
Sfinae and stuff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/xt/common/fixed_map.hh
+8
-19
8 additions, 19 deletions
dune/xt/common/fixed_map.hh
with
8 additions
and
19 deletions
dune/xt/common/fixed_map.hh
+
8
−
19
View file @
3eb4506e
...
...
@@ -126,30 +126,19 @@ private:
typedef
FixedMap
<
key_imp
,
T
,
nin
>
ThisType
;
template
<
class
K
>
// for sfinae to work this needs to be a template although the type is already fixed
typename
std
::
enable_if
<
std
::
is_convertible
<
K
,
std
::
string
>::
value
,
std
::
string
>::
type
range_error_message
(
K
key
)
const
std
::
string
range_error_message
(
key_imp
key
)
const
{
std
::
stringstream
ss
;
ss
<<
"missing key '"
<<
key
<<
"' in FixedMap!"
;
return
ss
.
str
();
}
template
<
class
K
>
typename
std
::
enable_if
<
std
::
is_convertible
<
K
,
int
>::
value
,
std
::
string
>::
type
range_error_message
(
K
key
)
const
{
std
::
stringstream
ss
;
ss
<<
"missing key (converted to int)'"
<<
int
(
key
)
<<
"' in FixedMap!"
;
if
constexpr
(
std
::
is_convertible
<
key_imp
,
std
::
string
>::
value
)
{
ss
<<
"missing key '"
<<
key
<<
"' in FixedMap!"
;
}
else
if
constexpr
(
std
::
is_convertible
<
key_imp
,
int
>::
value
)
{
ss
<<
"missing key (converted to int)'"
<<
int
(
key
)
<<
"' in FixedMap!"
;
}
else
{
ss
<<
"missing key is not printable"
;
}
return
ss
.
str
();
}
template
<
class
K
>
typename
std
::
enable_if
<!
(
std
::
is_convertible
<
K
,
int
>::
value
||
std
::
is_convertible
<
K
,
std
::
string
>::
value
),
std
::
string
>::
type
range_error_message
(
K
/*key*/
)
const
{
return
"missing key is not printable"
;
}
public
:
typedef
key_imp
key_type
;
typedef
T
mapped_type
;
...
...
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