Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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!
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

895 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now