LeechCraft
0.6.70-18450-gabe19ee3b0
Modular cross-platform feature rich live environment.
Toggle main menu visibility
Loading...
Searching...
No Matches
eithercont.h
Go to the documentation of this file.
1
/**********************************************************************
2
* LeechCraft - modular cross-platform feature rich internet client.
3
* Copyright (C) 2006-2014 Georg Rudoy
4
*
5
* Distributed under the Boost Software License, Version 1.0.
6
* (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7
**********************************************************************/
8
9
#pragma once
10
11
#include <functional>
12
13
namespace
LC
14
{
15
namespace
Util
16
{
29
template
<
typename
LeftSig,
typename
RightSig>
30
class
EitherCont
31
{
32
using
Left_f = std::function<LeftSig>;
33
using
Right_f = std::function<RightSig>;
34
Left_f Left_;
35
Right_f Right_;
36
public
:
40
EitherCont
() =
default
;
41
51
template
<
typename
L,
typename
R>
52
EitherCont
(
const
L& l,
const
R& r)
53
: Left_ { l }
54
, Right_ { r }
55
{
56
}
57
65
explicit
operator
bool ()
const
66
{
67
return
Left_ && Right_;
68
}
69
83
template
<
typename
... Args>
84
auto
Left
(Args&&... args)
const
85
{
86
return
Left_ (std::forward<Args> (args)...);
87
}
88
102
template
<
typename
... Args>
103
auto
Right
(Args&&... args)
const
104
{
105
return
Right_ (std::forward<Args> (args)...);
106
}
107
};
108
}
109
}
LC::Util::EitherCont::Right
auto Right(Args &&... args) const
Invoke the right function and return its result.
Definition
eithercont.h:103
LC::Util::EitherCont::Left
auto Left(Args &&... args) const
Invoke the left function and return its result.
Definition
eithercont.h:84
LC::Util::EitherCont::EitherCont
EitherCont()=default
Default-constructs the continuation with uninitialized functions.
LC::Util::EitherCont::EitherCont
EitherCont(const L &l, const R &r)
Sets the left and right functions to l and r.
Definition
eithercont.h:52
LC::Util
Definition
icoreproxy.h:34
LC
Definition
constants.h:15
src
util
sll
eithercont.h
Generated by
1.17.0