src/core/int-to-type.h
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Fri, 28 Sep 2007 10:32:59 +0200
changeset 1680 151684970a80
child 3372 184673f59f53
permissions -rw-r--r--
implement the helper IntToType template
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1680
151684970a80 implement the helper IntToType template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     1
#ifndef INT_TO_TYPE_H
151684970a80 implement the helper IntToType template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     2
#define INT_TO_TYPE_H
151684970a80 implement the helper IntToType template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     3
151684970a80 implement the helper IntToType template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     4
namespace ns3 {
151684970a80 implement the helper IntToType template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     5
151684970a80 implement the helper IntToType template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     6
/**
151684970a80 implement the helper IntToType template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     7
 * This trivial template is extremely useful, as explained in
151684970a80 implement the helper IntToType template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     8
 * "Modern C++ Design", p29, section 2.4, 
151684970a80 implement the helper IntToType template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     9
 * "Mapping Integral Constants to Types"
151684970a80 implement the helper IntToType template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    10
 */
151684970a80 implement the helper IntToType template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    11
template <int v>
151684970a80 implement the helper IntToType template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    12
struct IntToType
151684970a80 implement the helper IntToType template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    13
{
151684970a80 implement the helper IntToType template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    14
  enum {value = v};
151684970a80 implement the helper IntToType template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    15
};
151684970a80 implement the helper IntToType template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    16
151684970a80 implement the helper IntToType template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    17
} // namespace ns3
151684970a80 implement the helper IntToType template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    18
151684970a80 implement the helper IntToType template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    19
#endif /* INT_TO_TYPE_H */