You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-3Lines changed: 14 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ A modern C++-23 implementation of the Eclipse Sparkplug B 2.2 specification for
7
7
## Features
8
8
9
9
-**Full Sparkplug B 2.2 Compliance** - Implements the complete specification
10
-
-**Modern C++-23** - Uses latest C++ features (std::expected, ranges, modules-ready)
10
+
-**Modern C++-23 First** - Designed for C++-23, with compatibility for older stdlib implementations
11
11
-**Type Safe** - Leverages strong typing and compile-time checks
12
12
-**TLS/SSL Support** - Secure MQTT connections with optional mutual authentication
13
13
-**Easy Integration** - Simple EdgeNode/HostApplication API
@@ -72,6 +72,19 @@ If you're already specifying the thresholds, you might as well implement the com
72
72
73
73
**Bottom line:** This library provides the transport mechanisms (aliases, efficient binary encoding, sequence management) that enable RBE. You provide the intelligence that determines when metrics have meaningfully changed. This keeps sparkplug-cpp reusable, testable, and focused on doing one thing well.
74
74
75
+
## C++-23 First, With Compatibility Layer
76
+
77
+
This library is **designed for C++-23** and uses modern C++ features throughout (`std::expected`, ranges, concepts, etc.). This is the primary target.
78
+
79
+
However, some compilers lack full C++-23 standard library support - specifically `std::expected` (feature test macro `__cpp_lib_expected >= 202202L`). To maintain compatibility, we provide a thin compatibility layer (`include/sparkplug/detail/compat.hpp`) that:
80
+
81
+
-**On full C++-23 platforms** (Fedora 40+, macOS with Homebrew Clang): Uses native `std::expected`
82
+
-**On platforms lacking stdlib support** (e.g., Ubuntu 24.04 LTS with clang-18): Automatically falls back to `tl::expected` via CMake FetchContent
83
+
84
+
The compatibility layer uses feature detection macros to select the appropriate implementation at compile time. This is transparent to users - the API uses `sparkplug::stdx::expected` throughout, which resolves to the best available implementation.
85
+
86
+
**Why not just require full C++-23?** Many production systems rely on LTS releases that lag behind the standard. The compatibility layer is minimal (single header) and will be removed once common platforms provide full C++-23 stdlib support.
87
+
75
88
## Quick Start
76
89
77
90
### Prerequisites
@@ -175,8 +188,6 @@ cmake --preset default
175
188
cmake --build build -j$(nproc)
176
189
```
177
190
178
-
**Note:** This project uses a C++-23 compatibility layer. On platforms with full C++-23 support (Fedora 40+, macOS with Homebrew Clang), it uses native `std::expected`. On older platforms (Ubuntu 24.04 LTS), it automatically falls back to `tl::expected` via CMake FetchContent.
0 commit comments