[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [cdt-dev] Instantiating templates with dependent arguments
|
> An example:
> #include <vector>
> template<typename T>
> class Stack {
> std::vector<T> elems;
> };
> int main() {
> Stack<int> intStack;
> Stack<bool> boolStack;
> }
> intStack and boolStack both resolve to my primary template Stack. But
> if I resolve intStack our current context is T=int and I want to be
> able to also resolve the containing std::vector<T> elems to the primary
> template vector. By context I mean the types of all template
> parameters, in the above example T=int.
> But if I resolve boolStack my current context is T=bool so
> std::vector<T> elems should resolve to the fully specialized vector
> template. It should resolve to the same as when I have
> std::vector<bool>.
Suppose you start with the IASTName for 'boolStack'.
- Calling resolveBinding() should get you an ICPPVariable.
- Calling getType() on that should get you an ICPPClassSpecialization.
- Calling getFields() on that should get you an array of fields,
one of which should be an ICPPSpecialization, also implementing
ICPPField, corresponding to the 'elems' field.
- Calling ICPPField.getType() on that should give you an
ICPPClassSpecialization corresponding to 'std::vector<bool>'.
Is this what you had in mind?
Regards,
Nate