Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
// The code below figures out a type from the type of a pointer,
// reference, or the type itself

#ifndef GENERS_IOREFERREDTYPE_HH_
#define GENERS_IOREFERREDTYPE_HH_

#include "Alignment/Geners/interface/IOPtr.hh"
#include "Alignment/Geners/interface/StrippedType.hh"

namespace gs {
    template <class T>
    struct IOReferredType
    {
        typedef typename StrippedType<T>::type type;
    };

    // Qualifiers cannot be applied to references themselves,
    // only to the types they refer to
    template <class T>
    struct IOReferredType<T&>
    {
        typedef typename StrippedType<T>::type type;
    };

    template <class T>
    struct IOReferredType<IOPtr<T> >
    {
        typedef typename StrippedType<T>::type type;
    };

    template <class T>
    struct IOReferredType<const IOPtr<T> >
    {
        typedef typename StrippedType<T>::type type;
    };

    template <class T>
    struct IOReferredType<volatile IOPtr<T> >
    {
        typedef typename StrippedType<T>::type type;
    };

    template <class T>
    struct IOReferredType<const volatile IOPtr<T> >
    {
        typedef typename StrippedType<T>::type type;
    };

    template <class T>
    struct IOReferredType<IOProxy<T> >
    {
        typedef typename StrippedType<T>::type type;
    };

    template <class T>
    struct IOReferredType<const IOProxy<T> >
    {
        typedef typename StrippedType<T>::type type;
    };

    template <class T>
    struct IOReferredType<volatile IOProxy<T> >
    {
        typedef typename StrippedType<T>::type type;
    };

    template <class T>
    struct IOReferredType<const volatile IOProxy<T> >
    {
        typedef typename StrippedType<T>::type type;
    };
}

#endif // GENERS_IOREFERREDTYPE_HH_