src/core/int-to-type.h
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Sat, 04 Jul 2009 08:15:48 +0200
changeset 4654 2eaebe77d66b
parent 1680 151684970a80
permissions -rw-r--r--
Added tag ns-3.5 for changeset c975274c9707
mathieu@1680
     1
#ifndef INT_TO_TYPE_H
mathieu@1680
     2
#define INT_TO_TYPE_H
mathieu@1680
     3
mathieu@1680
     4
namespace ns3 {
mathieu@1680
     5
mathieu@1680
     6
/**
mathieu@1680
     7
 * This trivial template is extremely useful, as explained in
mathieu@1680
     8
 * "Modern C++ Design", p29, section 2.4, 
mathieu@1680
     9
 * "Mapping Integral Constants to Types"
mathieu@1680
    10
 */
mathieu@1680
    11
template <int v>
mathieu@1680
    12
struct IntToType
mathieu@1680
    13
{
mathieu@3372
    14
  enum v_e {value = v};
mathieu@1680
    15
};
mathieu@1680
    16
mathieu@1680
    17
} // namespace ns3
mathieu@1680
    18
mathieu@1680
    19
#endif /* INT_TO_TYPE_H */