implement the helper IntToType template
This commit is contained in:
19
src/core/int-to-type.h
Normal file
19
src/core/int-to-type.h
Normal 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 */
|
||||
@@ -95,5 +95,6 @@ def build(bld):
|
||||
'composite-trace-resolver.h',
|
||||
'array-trace-resolver.h',
|
||||
'trace-doc.h',
|
||||
'int-to-type.h',
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user