HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
utils.hpp
1// Copyright Take Vos 2020.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5#pragma once
6
7namespace tt {
8
12template<typename T, typename U>
13[[nodiscard]] bool compare_then_assign(T &lhs, U &&rhs) noexcept
14{
15 if (lhs != rhs) {
16 lhs = std::forward<U>(rhs);
17 return true;
18 } else {
19 return false;
20 }
21}
22
23template<typename... Args>
24[[nodiscard]] constexpr size_t nr_arguments(Args const &...args) noexcept
25{
26 return sizeof...(Args);
27}
28
29}