mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
23 lines
528 B
C++
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
|