summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/collections.hpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/collections.hpp b/lib/collections.hpp
index 18e6147..391647e 100644
--- a/lib/collections.hpp
+++ b/lib/collections.hpp
@@ -19,7 +19,7 @@ template<typename T>
concept IterableCollection = std::is_same_v<decltype(std::declval<T>().begin()), decltype(std::declval<T>().end())>;
template<typename T, std::size_t first, std::size_t second>
-constexpr std::array<T, first + second>
+[[nodiscard]] constexpr std::array<T, first + second>
operator+(const std::array<T, first> & a, const std::array<T, second> & b)
{
std::array<T, first + second> r;
@@ -30,7 +30,7 @@ operator+(const std::array<T, first> & a, const std::array<T, second> & b)
}
template<typename T, typename V, std::size_t first, std::size_t second>
-constexpr std::array<std::pair<T, V>, first * second>
+[[nodiscard]] constexpr std::array<std::pair<T, V>, first * second>
operator*(const std::array<T, first> & a, const std::array<V, second> & b)
{
std::array<std::pair<T, V>, first * second> r;
@@ -44,7 +44,7 @@ operator*(const std::array<T, first> & a, const std::array<V, second> & b)
}
template<typename T, std::size_t N>
-constexpr auto
+[[nodiscard]] constexpr auto
operator*(const std::array<T, N> & in, auto && f)
{
std::array<decltype(f(in[0])), N> out;
@@ -66,7 +66,7 @@ operator*=(std::span<T> & in, auto && f)
}
template<template<typename...> typename C, typename... T>
-constexpr auto
+[[nodiscard]] constexpr auto
operator*(const C<T...> & in, auto && f)
{
C<decltype(f(in[0]))> out;
@@ -85,7 +85,7 @@ operator+=(std::vector<T...> & in, std::vector<T...> && src)
}
template<typename... T, typename Vn>
-constexpr auto
+[[nodiscard]] constexpr auto
operator+(const std::vector<T...> & in, Vn && vn)
{
auto out(in);
@@ -94,7 +94,7 @@ operator+(const std::vector<T...> & in, Vn && vn)
}
template<template<typename> typename Direction = std::plus>
-static auto
+[[nodiscard]] static auto
vectorOfN(std::integral auto N, unsigned int start = {}, unsigned int step = 1)
{
std::vector<unsigned int> v;
@@ -106,14 +106,14 @@ vectorOfN(std::integral auto N, unsigned int start = {}, unsigned int step = 1)
}
template<template<typename...> typename Rtn = std::vector, IterableCollection In>
-auto
+[[nodiscard]] auto
materializeRange(In && in)
{
return Rtn(in.begin(), in.end());
}
template<template<typename...> typename Rtn = std::vector, typename In>
-auto
+[[nodiscard]] auto
materializeRange(const std::pair<In, In> & in)
{
return Rtn(in.first, in.second);