What does the below syntax represents?
typedef UserArray<T,W,L,H> MyType;
where:
- T = type of an array element
- W = width of an array element, 0 < W < 8
- L = low bound of array index (preferably zero)
- H = high bound of array index
Can anyone explain me using example for above declaration?
Does this concepts comes under STL?
UserArrayis a class template that takes four template parameters.It’s probably defined like that:
typedefis used to define aliases for types. This:Defines an alias for
UserArrayusing the specified template parameters.Tmust be a type, andW,LandHmust be compile-time integer constants. The resulting alias is calledMyType, and using it is like usingUserArraywith the same parameters.Those techniques are used to simplify typing when a type is used a lot in many places. For instance, you can do this: