16#include <fmt/format.h>
30std::string
joinToString(
const T& container,
const char* delimiter =
", ",
const std::string& elementFormat =
"")
33 std::for_each(container.begin(), container.end(), [&](
const auto& element) {
34 text += fmt::format(fmt::runtime(
"{" + elementFormat +
"}{}"), element, delimiter);
36 return text.substr(0, text.length() - strlen(delimiter));
43template<
typename T,
typename U>
47 std::for_each(container.begin(), container.end(), [&](
const auto& element) {
48 text += fmt::format(
"{}{}", formatFunc(element), delimiter);
50 return text.substr(0, text.length() - strlen(delimiter));
58template<std::
size_t N>
59bool operator<(
const std::bitset<N>& lhs,
const std::bitset<N>& rhs)
61 for (
size_t i = N - 1;; i--)
63 if (lhs[i] ^ rhs[i]) {
return rhs[i]; }
64 if (i == 0) {
break; }
std::string joinToString(const T &container, const char *delimiter=", ", const std::string &elementFormat="")
Joins the container to a string.
Definition STL.hpp:30
bool operator<(const std::bitset< N > &lhs, const std::bitset< N > &rhs)
Comparison operator for bitsets.
Definition STL.hpp:59
std::string joinToStringCustom(const T &container, U &&formatFunc, const char *delimiter=", ")
Joins the container to a string.
Definition STL.hpp:44