Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
13c77715
Commit
13c77715
authored
Oct 01, 2013
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tweaks for optional variant visitors
parent
0e8eabbd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
cppa/optional_variant.hpp
cppa/optional_variant.hpp
+6
-1
unit_testing/test_optional_variant.cpp
unit_testing/test_optional_variant.cpp
+3
-5
No files found.
cppa/optional_variant.hpp
View file @
13c77715
...
@@ -76,12 +76,15 @@ struct optional_variant_move_helper {
...
@@ -76,12 +76,15 @@ struct optional_variant_move_helper {
T
&
lhs
;
T
&
lhs
;
optional_variant_move_helper
(
T
&
lhs_ref
)
:
lhs
(
lhs_ref
)
{
}
optional_variant_move_helper
(
T
&
lhs_ref
)
:
lhs
(
lhs_ref
)
{
}
template
<
typename
U
>
template
<
typename
U
>
inline
void
operator
()(
const
U
&
rhs
)
const
{
inline
void
operator
()(
U
&
rhs
)
const
{
lhs
=
std
::
move
(
rhs
);
lhs
=
std
::
move
(
rhs
);
}
}
inline
void
operator
()()
const
{
inline
void
operator
()()
const
{
lhs
=
unit
;
lhs
=
unit
;
}
}
inline
void
operator
()(
const
none_t
&
)
const
{
lhs
=
none
;
}
};
};
template
<
typename
...
Ts
>
template
<
typename
...
Ts
>
...
@@ -382,6 +385,8 @@ struct optional_variant_cmp_helper {
...
@@ -382,6 +385,8 @@ struct optional_variant_cmp_helper {
operator
()(
const
U
&
)
const
{
return
false
;
}
operator
()(
const
U
&
)
const
{
return
false
;
}
// variant is void
// variant is void
bool
operator
()()
const
{
return
false
;
}
bool
operator
()()
const
{
return
false
;
}
// variant is undefined
bool
operator
()(
const
none_t
&
)
const
{
return
false
;
}
};
};
}
// namespace detail
}
// namespace detail
...
...
unit_testing/test_optional_variant.cpp
View file @
13c77715
...
@@ -28,13 +28,11 @@ struct int_visitor {
...
@@ -28,13 +28,11 @@ struct int_visitor {
using
dlimits
=
std
::
numeric_limits
<
double
>
;
using
dlimits
=
std
::
numeric_limits
<
double
>
;
struct
double_visitor
{
struct
double_visitor
{
double
operator
()(
none_t
)
const
{
return
dlimits
::
signaling_NaN
();
}
double
operator
()(
none_t
)
const
{
return
dlimits
::
signaling_NaN
();
}
double
operator
()(
void
)
const
{
return
dlimits
::
quiet_NaN
();
}
double
operator
()()
const
{
return
dlimits
::
quiet_NaN
();
}
double
operator
()(
int
i
)
const
{
return
i
;
}
template
<
typename
T
>
double
operator
()(
float
f
)
const
{
return
f
;
}
double
operator
()(
T
value
)
const
{
return
value
;
}
double
operator
()(
double
d
)
const
{
return
d
;
}
};
};
int
main
()
{
int
main
()
{
...
...
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