Public Types | List of all members
lar::util::details::dereferenced_type< T, CanDereference > Struct Template Reference

Class holding the type dereferenced from an object of type T. More...

#include <Dereference.h>

Public Types

using type = T
 

Detailed Description

template<typename T, bool CanDereference>
struct lar::util::details::dereferenced_type< T, CanDereference >

Class holding the type dereferenced from an object of type T.

Template Parameters
Tthe type to be tested
CanDereferencewhether T can be dereferenced or not
See also
lar::util::dereferenced_type

This class can be used as:

 static_assert(std::is_same<
   typename dereferenced_type<int, false>::type,
   int
   >::value,
   "error");
 static_assert(std::is_same<
   typename dereferenced_type<int*, true>::type,
   int&
   >::value,
   "error");

The type is contained in the type member of the class. The type is precisely what is obtained by dereferencing T (that is often a reference to a type). Note that the second parameter must express correctly whether the first type can be dereferenced or not. Clearly, this class is not very useful by itself, since we have to tell it how to do the trick (lar::util::dereferenced_type puts everything together). It is used in association with has_dereference_class.

The implementation is the usual two-definition one:

  1. generic class, always with the same type T (that we associate with CanDereference false)
  2. specialized class, with CanDereference explicitly set to true, that has the type *T

Definition at line 100 of file Dereference.h.

Member Typedef Documentation

template<typename T, bool CanDereference>
using lar::util::details::dereferenced_type< T, CanDereference >::type = T

Definition at line 102 of file Dereference.h.


The documentation for this struct was generated from the following file: