This project is read-only.

nsTypeSets::CDeploy template:

It's used like a category-tuple but only one type is allowed to exist in one nsTypeSets::CDeploy object declaration. If one type was used as more than one template-parameters, the compiling would fail. You may treat the nsTypeSets::CDeploy class as a type-set (the 'set' in mathiematia).
Currently there are up to 64 types could be as the template parameters together during instantiating a nsTypeSets::CDeploy class.
  • References can't be a member of a nsTypeSets::CDeploy class.
  • Two template parameters that belongs to the same type in different qualifies will be treated as the same type by the nsTypeSets::CDeploy. So any of the following lines would generate compiling errors:
    nsTypeSets::CDeploy<int, const int> o1;
    nsTypeSets::CDeploy<volatile int, int> o1;
    nsTypeSets::CDeploy<volatile int, const int> o1;
    nsTypeSets::CDeploy<const volatile int, int> o1;
  • void or void_t can't be a member of nsTypeSets::CDeploy class.
  • Initializations:
There are several ways to initialize a nsTypeSets::CDeploy object:
-Define a nsTypeSets::CDeploy object without parameter.
Cause all the members being initialized to there default state. If a member is native type, it will be initialized as zero.
-Define a nsTypeSets::CDeploy object with a void_t object.
The way is identical with the one without parameter.
-Define a nsTypeSets::CDeploy object with a tuple-class object,
In this way the count of parameters can't be less than the count of members. Sometime you need to initialize some with and others without parameters, you have to let the member support void_t as the parameter for constructor or add a container to let one member which doesn't have supported support void_t initialization.
For the security reason a nsTuple::CDeploy object can't be the parameter of the constructor while it is a rvalue. Use the nsTuple::CDeploy_r instead if necessary.

nsTypeSets::get function:

1. Getting the member with the specified type as _T_GET_.
If an object 'o1' is defined like:
    nsTypeSets::CDeploy<int, long, float, unsigned int> o1;
    auto & oq1 = nsTypeSets::get<int>(o1); // oq1 will be the type of int.
    auto & oq2 = nsTypeSets::get<float>(o1); // oq1 will be the type of float.
    auto & oq3 = nsTypeSets::get<unsigned int>(o1); // oq1 will be the type of unsigned int.
Specifying any other than one of the four types in calling 'get' to o1 should generate compiling errors.

2. Safe-casting to a sub-object from a nsTypeSets::CDeploy object.
If an object 'o1' is defined like:
    nsTypeSets::CDeploy<int, long, float, unsigned int> o1;
    nsTypeSets::CDeploy<long, float, unsigned int> & oq1 = o1;
    nsTypeSets::CDeploy<float, unsigned int> & oq1 = o1;
    nsTypeSets::CDeploy<unsigned int> & oq1 = o1;
are the o1's sub-objects, but something like
nsTypeSets::CDeploy<int, long, unsigned int>, nsTypeSets::CDeploy<int, long, float> are not.

3. Getting the count of members and current member index.
As a template class:
    nsTypeSets::CDeploy<int, long, float, unsigned int>;
the count of members in the class is:
    nsTypeSets::GetMemberCount<nsTypeSets::CDeploy<int, long, float, unsigned int>>::val;

To the object:
    nsTypeSets::CDeploy<int, long, float, unsigned int> o1;
the count of members in the object is:

Last edited Aug 23, 2011 at 6:16 AM by UnitUniverse, version 25


No comments yet.