Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2016-10-21
5
Medium Priority
?
51 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
[X]
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
  • 2
  • 2
5 Comments
 
LVL 35

Accepted Solution

by:
sarabande earned 1000 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 35

Assisted Solution

by:ste5an
ste5an earned 1000 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 35

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

650 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