I have some class C with const and non-const getters for some generic type Node:
template
Define a simple helper trait, which will add/remove const from a type based on whether another type is const:
template
using copy_const = typename std::conditional<
std::is_const::value,
const Dst,
typename std::remove_const::type
>::type;
And use it:
template
copy_const& AliasGetNode(CType* cobject);