AnCH Framework 0.2
Another C++ Hack: C++23 utility libraries
Loading...
Searching...
No Matches
anch::val::UniqueItems Struct Reference

Unique items constraint ( uniqueItems ). More...

#include <constraints.hpp>

Collaboration diagram for anch::val::UniqueItems:

Public Member Functions

template<anch::val::Collection V>
requires std::equality_comparable<std::ranges::range_value_t<V>>
bool check (const V &items, std::string &message) const

Detailed Description

Unique items constraint ( uniqueItems ).

Items have to be comparable with == . When they are also totally ordered, duplicates are found by sorting (O(n.log(n)) ), otherwise every pair of items is compared (O(n²) ).

Author
Vincent Lachenal
Since
0.2

Member Function Documentation

◆ check()

template<anch::val::Collection V>
requires std::equality_comparable<std::ranges::range_value_t<V>>
bool anch::val::UniqueItems::check ( const V & items,
std::string & message ) const

Check value

Template Parameters
Vthe value type
Parameters
itemsthe value
messagethe error message (set when value is invalid)
Returns
true when value is valid
Here is the call graph for this function:

The documentation for this struct was generated from the following file: