cronch

Concepts

As in the C++20 feature

General concepts

template<typename T>
concept serializable

Type that can be serialized by cronch at the most basic level.

Requirements
  • { metadata<T>::name } -> std::same_as<const char*>

template<typename T>
concept has_members

Type that can defines fields for use by cronch

Requirements
  • serializable

  • { metadata<T>::members } -> meta::concepts::view

template<typename T>
concept meta_complete

Type that satisfies all other concepts for meta information

Requirements
template<typename B>
concept serialization_backend

Type that can be used as a serialization backend

Requirements
  • B::serialize_to(typename B::document_type&, const meta_complete auto&)

template<typename B>
concept deserizalation_backend

Type that can be used for deserializing

Requirements
  • (const B& b, meta_complete auto& v) { b.deserialize_to(v); }

template<typename B>
concept backend

Type that can be used as a serializing/deserializing backend.

Requirements
Implementations
template<typename C>
concept iterable

Type that can be iterated over

Requirements
  • std::begin(c)

  • std::end(c)

Metadata concepts

template<typename G>
concept getter

A type that acts as a getter to a member of another type

Requirements
  • typename G::owning_type

  • typename G::value_type

  • std::invocable<G, const typename G::owning_type&>

  • std::same_as<std::invoke_result_t<G, const typename G::owning_type&>, typename G::value_type>

Implementations
template<typename S>
concept setter

A type that acts as a setter to a member of another type

Requirements
  • typename S::owning_type

  • typename S::value_type

  • std::invocable<S, typename G::owning_type&, typename S::value_type>

Implementations
template<typename A>
concept accessor

A type that acts as both a setter and getter for a member of another type

Requirements
Implementations
template<typename V>
concept view

A type that provides a view over the attributes of another type

Requirements
  • v.map([]<typename T>(T&&) requires(getter<T> || setter<T>){})

Implementations