Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
xerus
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
40
Issues
40
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xerus
xerus
Commits
8dd67869
Commit
8dd67869
authored
Jan 24, 2020
by
Sebastian Wolf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow C++14 compilation.
parent
d925ba39
Pipeline
#1864
failed with stages
in 12 minutes and 39 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
2 deletions
+23
-2
include/xerus/misc/exceptions.h
include/xerus/misc/exceptions.h
+23
-2
No files found.
include/xerus/misc/exceptions.h
View file @
8dd67869
...
...
@@ -43,13 +43,34 @@ namespace xerus {
};
/// @brief The pipe operator allows to add everything that can be converted to string to the error_info and derived exceptions.
template
<
typename
error_t
,
class
T
,
typename
std
::
enable_if
<
std
::
is_base_of
<
generic_error
,
std
::
remove_cvref_t
<
error_t
>
>::
value
,
int
>::
type
=
0
>
std
::
remove_cvref_t
<
error_t
>&
operator
<<
(
error_t
&&
o
,
const
T
&
_info
)
noexcept
{
template
<
typename
error_t
,
class
T
>
typename
std
::
enable_if
<
std
::
is_base_of
<
generic_error
,
error_t
>::
value
,
error_t
&>::
type
operator
<<
(
error_t
&
o
,
const
T
&
_info
)
noexcept
{
std
::
ostringstream
errorStream
(
o
.
errorInfo
,
std
::
ios_base
::
ate
|
std
::
ios_base
::
out
);
errorStream
<<
_info
;
o
.
errorInfo
=
errorStream
.
str
();
return
o
;
}
/// @brief The pipe operator allows to add everything that can be converted to string to the error_info and derived exceptions.
template
<
typename
error_t
,
class
T
>
typename
std
::
enable_if
<
std
::
is_base_of
<
generic_error
,
error_t
>::
value
,
error_t
&>::
type
operator
<<
(
error_t
&&
o
,
const
T
&
_info
)
noexcept
{
std
::
ostringstream
errorStream
(
o
.
errorInfo
,
std
::
ios_base
::
ate
|
std
::
ios_base
::
out
);
errorStream
<<
_info
;
o
.
errorInfo
=
errorStream
.
str
();
return
o
;
}
// Once we have C++20... :-/
// /// @brief The pipe operator allows to add everything that can be converted to string to the error_info and derived exceptions.
// template<typename error_t, class T, typename std::enable_if<std::is_base_of<generic_error, std::remove_cvref_t<error_t>>::value, int>::type = 0>
// std::remove_cvref_t<error_t>& operator<<(error_t&& o, const T& _info) noexcept {
// std::ostringstream errorStream(o.errorInfo, std::ios_base::ate | std::ios_base::out);
// errorStream << _info;
// o.errorInfo = errorStream.str();
// return o;
// }
}
}
...
...
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