2023-03-06 14:42:04 +01:00
|
|
|
// SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
// author: Max Kellermann <max.kellermann@gmail.com>
|
2022-06-08 20:58:22 +02:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <type_traits>
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Generate a type based on #To with the same const-ness as #From.
|
|
|
|
*/
|
|
|
|
template<typename To, typename From>
|
|
|
|
using CopyConst = std::conditional_t<std::is_const_v<From>,
|
2022-06-08 21:07:45 +02:00
|
|
|
std::add_const_t<To>,
|
|
|
|
std::remove_const_t<To>>;
|