FuncSketch
Loading...
Searching...
No Matches
any.h
Go to the documentation of this file.
1
/*
2
* Copyright 2026 MusicScience37 (Kenta Kabashima)
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
20
#pragma once
21
22
#include <any>
23
#include <type_traits>
24
#include <utility>
25
26
namespace
func_sketch::utilities {
27
33
class
Any
{
34
public
:
40
template
<
typename
T>
41
requires
(!std::is_same_v<std::decay_t<T>,
Any
>)
42
explicit
Any
(T&& value) :
value_
(std::forward<T>(value)) {}
43
50
template
<
typename
T>
51
[[nodiscard]]
const
T&
get
()
const
{
52
return
std::any_cast<const T&>(
value_
);
53
}
54
55
private
:
57
std::any
value_
;
58
};
59
60
}
// namespace func_sketch::utilities
func_sketch::utilities::Any::get
const T & get() const
Get the stored value.
Definition
any.h:51
func_sketch::utilities::Any::value_
std::any value_
Stored value.
Definition
any.h:57
func_sketch::utilities::Any::Any
Any(T &&value)
Constructor.
Definition
any.h:42
include
func_sketch
utilities
any.h
Generated on
for FuncSketch by
1.15.0