templates - How to make C++ find templated function header when dependent-scoped inner classes are involved? -


I am trying to create a templated C ++ function which accepts it as its logic, An indicator for an inner square object Here is a small version of class structure similar to a specific link-list or tree class:

  template & lt; Typename T & gt; Structure Inner {T-Wall; Inner (TV): Well (V) {}}; Inner * PTR; Exterior (t-wall) {pt = new inner (val); }};   

I have created a structure to exclude them from any access control problems and removed some extraordinary example variables. In the brain with the structure of that class, there are three functions, The first of which I do not want much:

  template & lt; Typename T & gt; Zero TestOper (Cust Outr & Lt; T & G & OBJ) {cout & lt; & Lt; Obj.ptr- & gt; Val & lt; & Lt; Endl; } Zero Test InnerIt (infected external ; inner p) {cout & lt; & Lt; P-> Val & lt; & Lt; Endl; } Template & lt; Typename T & gt; Zero test infra-implied (Constant Tyman's external ; inner * p) {cout & lt; & Lt; P-> Val & lt; & Lt; Endl; }   

This third task is basically what I need, header-wise (this is definitely to be done as an assistant function in a large body of code), but it does not work . If I compile and run the following main function:

  int main () {External & lt; Int & gt; Foo (5); Cout & lt; & Lt; Foo.ptr-> Val & lt; & Lt; Endl; TestInnerInt (foo.ptr); //testInnerTemplated(foo.ptr); TestOuter (foo); }   

It runs just fine (printing 5 three times), but if I connect the call to testInnerTemplated Then I do not call any calling function to call to get a compiler error (external & lt; int & gt; inner * & amp;) ???? (in G ++ 4.9.1). I think this is a problem with template lookup or matching, but how can I tell the compiler how to solve it?

  template & lt; Typename T & gt; Zero test infra-implied (Const Tynam External  :: Inner *);   

The compiler can not remove the T template by logic deduction because it is a non-approximate reference as defined in the standard:

The nondeduced references are as follows:

The nested-name-specific is a type that was specified using the qualified-id. A type that is a template-id in which one or more template-arguments are an expression that references a template-parameter.

When any type of name is specified in a context that contains a referenced reference, all types of names included in that type of names are also included, however, in both a compound type, And non-ordered types may be included. [Example: if one type a is specified in the form of both, T and T2 are nondeduced similarly, if one type A I + J & Gt; :: X; T & gt; , I , J , and are specified as, T is encoded if a type is void f (Typename A & lt; T & gt; :: B, A & T; T & gt;) , T in a & lt; T & gt; B is specified as :: is rejected but T contains a is estimated. ]

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -