meta::copyable

Defined in header <mgs/meta/concepts/copyable.hpp>.

template <typename  T>
concept copyable =
  meta::copy_constructible<T> &&
  meta::movable<T> &&
  meta::assignable_from<T&, T const&>;

Pre-C++20 implementation of the std::copyable concept.


Concept emulation

namespace mgs {
namespace meta {

template <typename T>
struct is_copyable { /* ... */ };

template <typename T>
constexpr auto is_copyable_v = is_copyable<T>::value;

template <typename T,
          typename = std::enable_if_t<is_copyable_v<T>>>
using copyable = T;

} // namespace meta
} // namespace mgs

Example

#include <mgs/meta/concepts/copyable.hpp>

using namespace mgs::meta;

static_assert(is_copyable_v<std::string>, "");
static_assert(!is_copyable_v<std::string&>, "");