Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
typon-concurrency
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
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
Xavier Thompson
typon-concurrency
Commits
8c717087
Commit
8c717087
authored
Jun 03, 2022
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify optional.hpp
parent
0c74060c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
15 deletions
+8
-15
rt/include/typon/fundamental/optional.hpp
rt/include/typon/fundamental/optional.hpp
+8
-15
No files found.
rt/include/typon/fundamental/optional.hpp
View file @
8c717087
...
...
@@ -11,9 +11,6 @@ namespace typon::fdt
requires
std
::
is_trivially_copyable_v
<
T
>
struct
optional
{
template
<
unsigned
char
I
>
using
state
=
std
::
integral_constant
<
unsigned
char
,
I
>
;
unsigned
char
_state
;
union
{
...
...
@@ -22,14 +19,12 @@ namespace typon::fdt
optional
()
noexcept
:
_state
(
0
)
{}
template
<
unsigned
char
I
>
optional
(
state
<
I
>
state
)
noexcept
:
_state
(
state
()
<<
1
&
(
~
1
))
{}
optional
(
T
value
)
noexcept
:
_state
(
1
),
_value
(
value
)
{}
template
<
unsigned
char
I
>
optional
(
T
value
,
state
<
I
>
state
)
noexcept
:
_state
((
state
()
<<
1
)
|
1
)
optional
(
unsigned
char
flags
)
noexcept
:
_state
(
flags
<<
1
)
{}
optional
(
T
value
,
unsigned
char
flags
)
noexcept
:
_state
((
flags
<<
1
)
|
1
)
,
_value
(
value
)
{}
...
...
@@ -46,16 +41,14 @@ namespace typon::fdt
return
_state
&
1
;
}
template
<
unsigned
char
I
>
bool
match
(
state
<
I
>
state
)
noexcept
unsigned
char
get_flags
()
noexcept
{
return
state
()
==
_state
>>
1
;
return
_state
>>
1
;
}
template
<
unsigned
char
I
>
void
set_state
(
state
<
I
>
state
)
noexcept
void
set_flags
(
unsigned
char
flags
)
noexcept
{
_state
=
(
state
()
<<
1
)
|
(
_state
&
1
);
_state
=
(
flags
<<
1
)
|
(
_state
&
1
);
}
T
*
operator
->
()
noexcept
...
...
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