mpd/src/util/CopyConst.hxx

15 lines
371 B
C++
Raw Normal View History

// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
#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>>;