Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
P
PI2 View
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
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
PI2
PI2 View
Commits
99882a22
Commit
99882a22
authored
Mar 27, 2019
by
Martin Kröning
🦀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove DeferralActionWrapper.hpp
parent
1db1f11a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
44 deletions
+0
-44
pi2-demo/include/DeferralActionWrapper.hpp
pi2-demo/include/DeferralActionWrapper.hpp
+0
-44
No files found.
pi2-demo/include/DeferralActionWrapper.hpp
deleted
100644 → 0
View file @
1db1f11a
#pragma once
#include <functional>
#include <vector>
/// Wraps an object and defers modifying actions
/// until explicitly applying them
///
/// \param T The type of the wrapped object
template
<
typename
T
>
class
DeferralActionWrapper
{
public:
using
ValueType
=
T
;
using
Function
=
std
::
function
<
void
(
ValueType
&
)
>
;
/// Constructs a wrapper around a default constructed object
DeferralActionWrapper
()
=
default
;
/// Constructs a wrapper around a given \p object
explicit
DeferralActionWrapper
(
ValueType
object
)
:
wrappedObject
(
std
::
move
(
object
))
{}
/// Returns a the wrapped object
ValueType
&
get
()
{
return
wrappedObject
;
}
const
ValueType
&
get
()
const
{
return
wrappedObject
;
}
/// Enqueues an \p action
///
/// Caution: Be sure to work on a reference to modify the wrapped object!
void
enqueue
(
Function
action
)
{
deferredActions
.
push_back
(
std
::
move
(
action
));
}
/// Applies pending modifying actions
void
apply
()
{
for
(
auto
&&
action
:
deferredActions
)
{
action
(
wrappedObject
);
}
deferredActions
.
clear
();
}
private:
ValueType
wrappedObject
;
std
::
vector
<
Function
>
deferredActions
;
};
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