[Dune-devel] dune/common/utilities.hh ?

Carsten Gräser graeser at mi.fu-berlin.de
Mon Nov 9 16:55:24 CET 2015


Dear all,
I recently added PriorityTag to dune-common which allows
to give priorities to otherwise ambiguous overloads in
a readable way. Since there was no appropriate header
I added a new one despite the trivial nature of this class.
Now I'd like to add another tiny utility which is not
even a class but just a template alias (see below).

Because I expect that there will come more of these
guys I'd like to put this in a proper place. The
standard lib contains such stuff spread in <utility>
and <type_traits>. But non of these guys provide type
information so typetraits.hh seems to not fit.

Any objections against or better alternatives to utility.hh?
I hesitate to introduce this, because we explicitly
abandoned such 'all-purpose' headers some time ago.

Best,
Carsten


/**
 * \brief Helper to disable constructor as copy and move constructor
 *
 * \ingroup Utility
 *
 * Helper typedef to remove constructor with forwarding reference from
 * overload set for copy and move constructor or assignment.
 */
template<class This, class... T>
using disableCopyMove = typename std::enable_if<
  (not(std::is_same<This, typename std::tuple_element<0, std::tuple<typename std::decay<T>::type...> >::type >::value)
  and not(std::is_base_of<This, typename std::tuple_element<0, std::tuple<typename std::decay<T>::type...> >::type >::value)), int>::type;




-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <https://lists.dune-project.org/pipermail/dune-devel/attachments/20151109/e889d8a5/attachment.sig>


More information about the Dune-devel mailing list