SimiLie
Loading...
Searching...
No Matches
are_all_same.hpp
1// SPDX-FileCopyrightText: 2024 Baptiste Legouix
2// SPDX-License-Identifier: AGPL-3.0-or-later
3
4#pragma once
5
6#include <Kokkos_Core.hpp>
7
8#include "specialization.hpp"
9
10namespace sil {
11
12namespace misc {
13
14template <class Head, class... Tail>
15inline constexpr bool are_all_same = (std::is_same_v<Head, Tail> && ...);
16
17template <class Head, class... Tail>
18KOKKOS_FUNCTION inline constexpr bool are_all_equal(Head const& head, Tail const&... tail)
19{
20 return ((head == tail) && ...);
21}
22
23template <misc::Specialization<std::vector> T>
24inline constexpr bool are_all_equal(T const& t)
25{
26 return std::all_of(t.begin(), t.end(), [&](const std::size_t i) { return i == *t.begin(); });
27}
28
29} // namespace misc
30
31} // namespace sil
constexpr bool are_all_same
KOKKOS_FUNCTION constexpr bool are_all_equal(Head const &head, Tail const &... tail)
The top-level namespace of SimiLie.
Definition csr.hpp:15