mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-03 16:56:48 +00:00
21 lines
483 B
C++
21 lines
483 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 MaybeConst
|
|
{
|
|
explicit MaybeConst() = default;
|
|
using type = std::
|
|
conditional_t<IsConst, typename std::remove_const<T>::type const, std::remove_const_t<T>>;
|
|
};
|
|
|
|
/** Alias for omitting `typename`. */
|
|
template <bool IsConst, class T>
|
|
using maybe_const_t = typename MaybeConst<IsConst, T>::type;
|
|
|
|
} // namespace beast
|