implement the helper IntToType template

This commit is contained in:
Mathieu Lacage
2007-09-28 10:32:59 +02:00
parent 343d9fd63f
commit 13347878df
2 changed files with 20 additions and 0 deletions

19
src/core/int-to-type.h Normal file
View File

@@ -0,0 +1,19 @@
#ifndef INT_TO_TYPE_H
#define INT_TO_TYPE_H
namespace ns3 {
/**
* This trivial template is extremely useful, as explained in
* "Modern C++ Design", p29, section 2.4,
* "Mapping Integral Constants to Types"
*/
template <int v>
struct IntToType
{
enum {value = v};
};
} // namespace ns3
#endif /* INT_TO_TYPE_H */

View File

@@ -95,5 +95,6 @@ def build(bld):
'composite-trace-resolver.h',
'array-trace-resolver.h',
'trace-doc.h',
'int-to-type.h',
]