12 #ifndef DOCWIRE_ENFORCE_H
13 #define DOCWIRE_ENFORCE_H
15 #include "safety_policy.h"
16 #include "with_source_location.h"
17 #include "make_error.h"
18 #include "error_tags.h"
19 #include "debug_assert.h"
37 template<
safety_policy safety_level = default_safety_level,
typename... Context>
42 if constexpr (safety_level ==
strict) {
auto make_error_from_tuple(const source_location &location, std::tuple< Context... > &&context_tuple)
Creates an error object from a tuple of context information.
The main namespace for the DocWire SDK.
void enforce(detail::with_source_location< bool > condition, Context &&... context)
Enforces a condition based on the safety policy.
void debug_assert(detail::with_source_location< bool > condition, Context &&... context)
Asserts a condition in debug builds.
safety_policy
Defines the safety policy for operations.
@ strict
Perform runtime checks and throw exceptions on violations.
Helper struct to capture the source location of a call site. This is implicitly constructed from a va...
Program logic failure error tag.