Clingo
Loading...
Searching...
No Matches

Helpers to declare records with keyword arguments. More...

Concepts

concept  CppClingo::Util::Record::ValidArguments
 Concept requiring arguments to be valid.
 

Classes

struct  CppClingo::Util::Record::AttributeValue< T, C, V >
 Helper to capture a value bound by an attribute. More...
 
struct  CppClingo::Util::Record::AttributeName< T, C >
 A named attribute. More...
 
class  CppClingo::Util::Record::Base< Rec >
 Record base class to enable keyword argument based record updates. More...
 

Functions

template<auto i, auto needle, auto tag, auto... tags>
constexpr auto CppClingo::Util::Record::get_index_ ()
 Get the index of an attribute tag.
 
template<auto tag, class... Attrs>
constexpr auto CppClingo::Util::Record::get_index (std::tuple< Attrs... > names)
 Get the index of an attribute tag.
 
template<class Arg , class... Attrs>
constexpr auto CppClingo::Util::Record::is_valid_argument (std::tuple< Attrs... > attrs) -> bool
 Check if an argument is valid.
 
template<class Arg , class... Args>
constexpr auto CppClingo::Util::Record::is_unique_argument ()
 Check if an argument is unique.
 
template<class Arg , class... Args>
constexpr auto CppClingo::Util::Record::check_unique_arguments ()
 Check if all arguments are unique.
 
template<auto tag, bool Opt, class Rec , class Arg , class... Args>
auto CppClingo::Util::Record::select_value (Rec const &rec, Arg &arg, Args &...args) -> decltype(auto)
 Select the argument with the given tag among the given arguments.
 
template<bool Opt = false, typename Rec , typename... Args>
auto CppClingo::Util::Record::update_record (Rec const &x, Args &&...args) -> Rec
 Update a record by returning a copy with the given arguments updated.
 
template<class Rec , class... Args>
auto CppClingo::Util::Record::rewrite_record (Rec const &x, Args &&...args) -> std::optional< Rec >
 Rewrite a record by returning a copy with the given arguments updated.
 

Detailed Description

Helpers to declare records with keyword arguments.

Function Documentation

◆ rewrite_record()

template<class Rec , class... Args>
auto CppClingo::Util::Record::rewrite_record ( Rec const &  x,
Args &&...  args 
) -> std::optional<Rec>

Rewrite a record by returning a copy with the given arguments updated.

Requires that arguments are passed as optionals (or similar). At least one argument has to be engaged, to produce a result.

◆ select_value()

template<auto tag, bool Opt, class Rec , class Arg , class... Args>
auto CppClingo::Util::Record::select_value ( Rec const &  rec,
Arg &  arg,
Args &...  args 
) -> decltype(auto)

Select the argument with the given tag among the given arguments.

If Opt is true, the arguments are supposed to be wrapped in optionals. If the argument is not found or not engaged, it is taken from the given record.

◆ update_record()

template<bool Opt = false, typename Rec , typename... Args>
auto CppClingo::Util::Record::update_record ( Rec const &  x,
Args &&...  args 
) -> Rec

Update a record by returning a copy with the given arguments updated.

If Opt is true, the arguments are supposed to be wrapped in optionals. If the argument is not engaged, it is taken from the given record.