REDAC HybridController
Firmware for LUCIDAC/REDAC Teensy
Loading...
Searching...
No Matches
helpers.h
Go to the documentation of this file.
1// Copyright (c) 2024 anabrid GmbH
2// Contact: https://www.anabrid.com/licensing/
3//
4// SPDX-License-Identifier: MIT OR GPL-2.0-or-later
5
6#pragma once
7
8#include <tuple>
9
10// Helper to check if all values in a tuple are unique
11template <typename Tuple, std::size_t... Is>
12constexpr bool all_unique_impl(const Tuple& t, std::index_sequence<Is...>) {
13 return ((std::get<Is>(t) != std::get<Is + 1>(t)) && ...);
14}
15
16template <typename... Args>
17constexpr bool all_unique(const std::tuple<Args...>& t) {
18 return all_unique_impl(t, std::make_index_sequence<sizeof...(Args) - 1>{});
19}
constexpr bool all_unique(const std::tuple< Args... > &t)
Definition helpers.h:17
constexpr bool all_unique_impl(const Tuple &t, std::index_sequence< Is... >)
Definition helpers.h:12