2
3
4
5
6
7
22concept printable = requires(
const T &obj, std::ostream &os) {
27namespace printing_detail {
29 concept string = std::same_as<std::string, std::remove_cvref_t<T>>
or
30 std::same_as<std::string_view, std::remove_cvref_t<T>>
or
31 std::same_as<std::decay_t<T>,
char *>
or
32 std::same_as<std::decay_t<T>,
const char *>;
34 template<std::size_t Idx,
typename Tuple>
35 void printElem(std::ostream &os,
const Tuple &tuple) {
36 if constexpr (Idx != 0) {
40 os << std::get<Idx>(tuple);
45 template<printable ...Ts>
46 std::ostream &operator<<(std::ostream &os,
const std::tuple<Ts...> &tuple) {
48 [&]<std::size_t ... Idx>(std::index_sequence<Idx...>) {
49 (printing_detail::printElem<Idx>(os, tuple), ...);
50 }(std::make_index_sequence<
sizeof...(Ts)>());
55 template<printable T, printable U>
56 std::ostream &operator<<(std::ostream &os,
const std::pair<T, U> &pair) {
57 os <<
"(" << pair.first <<
", " << pair.second <<
")";
61 template<std::ranges::range R>
62 requires(printable<std::ranges::range_value_t<R>>
and
63 not printing_detail::string<R>)
64 std::ostream &operator<<(std::ostream &os, R &&range) {
67 for (
const auto &elem: std::forward<R>(range)) {
83
84
85 std::ostream &operator<<(std::ostream &os,
Variable x);
88
89
90 std::ostream &operator<<(std::ostream &os,
Literal l);
Structure representing a literal in a CNF-SAT problem.
Definition basic_structures.hpp:56
unsigned get() const
Definition basic_structures.cpp:30
short sign() const
Definition basic_structures.cpp:38
Structure representing a binary variable in a CNF-SAT problem.
Definition basic_structures.hpp:29
unsigned get() const
Definition basic_structures.cpp:18
Definition basic_structures.cpp:10
Variable var(Literal l)
Definition basic_structures.cpp:54