Solved

What does this  TN Map<T, TN>(T src) mean?

Posted on 2016-10-21
5
38 Views
Last Modified: 2016-10-22
Please explain TN Map<T, TN>(T src)

        public static TN Map<T, TN>(T src)
        {
            return Instance.Map<T, TN>(src);
        }

        public static TN Map<T, TN>(T src, TN dest)
        {
            return Instance.Map(src, dest);
}

Open in new window

0
Comment
Question by:JRockFL
  • 2
  • 2
5 Comments
 
LVL 33

Accepted Solution

by:
sarabande earned 250 total points
ID: 41855206
they are template member functions named Map returning type TN.

the first function takes one input argument src of type T. the second one takes two arguments T and TN both by value.

template functions can be arbitrary change their template types. for example, T may be 'int' and TN may be 'std::string'. if the compiler detects a call using the Map member functions, it instantiates the (inlined) template code by replacing the placeholders T and TN with int and std::string. in the current code the Instance.Map function must support the chosen template types, or the compiler will complain.

Sara
1
 
LVL 8

Author Comment

by:JRockFL
ID: 41855259
Ok, I think that makes. I have not used them before. Ultimately, I'm trying to make a basic mapper that will map two lists. I didn't want to code try and code something too fancy that I don't understand.
0
 
LVL 33

Assisted Solution

by:ste5an
ste5an earned 250 total points
ID: 41855266
As your post is tagged C#:

These are Generics.

TN Map<T, TN>(T src) means you have a function where you pass in a parameter named src of type T and you'll get a return value of type TN.
The actual types are defined when you invoke your function.

And last but not least: The return Instance.Map<> indicates that a singelton is used (for whatever reason).
0
 
LVL 8

Author Closing Comment

by:JRockFL
ID: 41855293
Thank you!
0
 
LVL 33

Expert Comment

by:ste5an
ID: 41855352
Templates in C++, while being similar, are not equivalent to Generics in C#.

So are you using C# or C++?
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Error in JQuery 5 51
Signal R -send data to client: only if they are allowed to see it ? 1 51
rest webservice call over https via c# 6 37
designing in object programming 12 75
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question