Is it possible to disable building a copy of a class based on the properties of its template parameters?

The option is an obvious example for this:

template <typename... Ts>
class variant {
  using types = meta::list<Ts...>;

  variant() = default;

  template <typename = std::enable_if_t<
    meta::all_of<types, meta::quote<std::is_copy_constructible>>{}
  >
  variant(const variant &);
};

Using Meta , remove the TMP template code around the check to ensure that the entire parameter package matches the attribute.

I know this is not true since the copy constructor cannot be a template among other restrictions. Is this something that can be done differently? C ++ 14 + should be fine since I am using GCC 4.9 and Clang 3.5.

+4
source share

No one has answered this question yet.


All Articles