Files
rippled/include/xrpl/beast/utility/maybe_const.h
2026-02-20 12:15:30 -05:00

23 lines
528 B
C++

#pragma once
#include <type_traits>
namespace beast {
/** Makes T const or non const depending on a bool. */
template <bool IsConst, class T>
struct maybe_const
{
explicit maybe_const() = default;
using type = typename std::conditional<
IsConst,
typename std::remove_const<T>::type const,
typename std::remove_const<T>::type>::type;
};
/** Alias for omitting `typename`. */
template <bool IsConst, class T>
using maybe_const_t = typename maybe_const<IsConst, T>::type;
} // namespace beast