AsyncFw 1.2
Async Framework is c++ runtime with timers, poll notifiers, sockets, coroutines, etc.
 
Loading...
Searching...
No Matches
AnyData.h
1/*
2Copyright (c) 2026 Alexandr Kuzmuk
3
4This file is part of the AsyncFw project. Licensed under the MIT License.
5See {Link: LICENSE file https://mit-license.org} in the project root for full license information.
6*/
7
8#pragma once
9
10#include <any>
11
12namespace AsyncFw {
14struct AnyData {
15 template <typename T>
16 T data() const {
17 return std::any_cast<T>(data_);
18 }
19 AnyData(const std::any &);
20 AnyData();
21 ~AnyData();
22 std::any &data() const { return data_; }
23 void setData(const std::any &data) const { data_ = data; };
24
25protected:
26 mutable std::any data_;
27};
28} // namespace AsyncFw