Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2016-10-21
5
39 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

856 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