mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-03 16:56:48 +00:00
Co-authored-by: Bart <11445373+bthomee@users.noreply.github.com> Co-authored-by: Bart <bthomee@users.noreply.github.com>
21 lines
486 B
C++
21 lines
486 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 = 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 maybe_const<IsConst, T>::type;
|
|
|
|
} // namespace beast
|