You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

17 lines
575 B

/**
* 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