Sparkplug B C++ Library 1.0.0
Modern C++-23 implementation of Eclipse Sparkplug B 2.2 specification
Loading...
Searching...
No Matches
compat.hpp
1#pragma once
2
3// Compatibility layer for C++23 features
4// Provides fallbacks for older compilers that lack full C++23 stdlib support
5
6// std::expected compatibility
7// Feature test macro from: https://en.cppreference.com/w/cpp/feature_test
8#if __cpp_lib_expected >= 202202L
9// Compiler has C++23 std::expected in stdlib
10# include <expected>
11namespace sparkplug::stdx {
12using std::expected;
13using std::unexpected;
14} // namespace sparkplug::stdx
15#else
16// Fallback to tl::expected for older compilers (e.g., Ubuntu 24.04 LTS)
17# include <tl/expected.hpp>
18namespace sparkplug::stdx {
19using tl::expected;
20using tl::unexpected;
21} // namespace sparkplug::stdx
22#endif