Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F7888672
maybe.hpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
788 B
Referenced Files
None
Subscribers
None
maybe.hpp
View Options
/*
* This file is part of libkazv.
* SPDX-FileCopyrightText: 2021 Tusooa Zhu <tusooa@kazv.moe>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#pragma once
#include
"libkazv-config.hpp"
#include
<string>
#include
<optional>
namespace
Kazv
{
class
NotBut
{
std
::
string
m_reason
;
public
:
explicit
NotBut
(
std
::
string
r
)
:
m_reason
(
r
)
{}
std
::
string
reason
()
const
{
return
m_reason
;
}
};
template
<
class
T
>
class
Maybe
:
public
std
::
optional
<
T
>
{
std
::
string
m_reason
;
using
BaseT
=
std
::
optional
<
T
>
;
public
:
Maybe
(
T
x
)
:
BaseT
(
x
)
{}
Maybe
(
NotBut
r
)
:
BaseT
(),
m_reason
(
r
.
reason
())
{}
std
::
string
reason
()
const
{
return
m_reason
;
}
};
using
MaybeString
=
Maybe
<
std
::
string
>
;
}
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Thu, Oct 2, 1:57 AM (5 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
472949
Default Alt Text
maybe.hpp (788 B)
Attached To
Mode
rL libkazv
Attached
Detach File
Event Timeline
Log In to Comment