|
/**
|
|
* Copyright (c) 2018 Niklas Rosenstein
|
|
* MIT licensed.
|
|
*
|
|
* @description Some useful type traits.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
namespace niklasrosenstein {
|
|
|
|
/* Adds "const" to a type only if the other type is const. */
|
|
template <typename SRC, typename DST> struct add_const_from { using type = DST; };
|
|
template <typename SRC, typename DST> struct add_const_from<const SRC, DST> { using type = typename std::add_const<DST>::type; };
|
|
template <typename SRC, typename DST> using add_const_from_t = typename add_const_from<SRC, DST>::type;
|
|
|
|
} // namespace niklasrosenstein
|