C++ Function Templates

C++ Function Templates

by: Muthukumar

C++ Function templates are those functions which can handle different data types without separate code for each of them. For a similar operation on several kinds of data types, a programmer need not write different versions by overloading a function. It is enough if he writes a C++ template based function. This will take care of all the data types.

There are two types of templates in C++, viz., function templates and class templates. This article deals with only the function templates.

There are lot of occasions, where we might need to write the same functions for different data types. A favorite example can be addition of two variables. The variable can be integer, float or double. The requirement will be to return the corresponding return type based on the input type. If we start writing one function for each of the data type, then we will end up with 4 to 5 different functions, which can be a night mare for maintenance.

C++ templates come to our rescue in such situations. When we use C++ function templates, only one function signature needs to be created. The C++ compiler will automatically generate the required functions for handling the individual data types. This is how a programmerกs life is made a lot easier.

C++ Template functions Details:

Let us assume a small example for Add function. If the requirement is to use this Add function for both integer and float, then two functions are to be created for each of the data type (overloading).

int Add(int a,int b) { return a+b;} // function Without C++ template

float Add(float a, float b) { return a+b;} // function Without C++ template

If there are some more data types to be handled, more functions should be added.

But if we use a c++ function template, the whole process is reduced to a single c++ function template. The following will be the code fragment for Add function.

template

T Add(T a, T b) //C++ function template sample

{

return a+b;

}

This c++ function template definition will be enough. Now when the integer version of the function, the compiler generates an Add function compatible for integer data type and if float is called it generates float type and so on.

Here T is the typename. This is dynamically determined by the compiler according to the parameter passed. The keyword class means, the parameter can be of any type. It can even be a class.

C++ Template functions Applicability:

C++ function templates can be used wherever the same functionality has to be performed with a number of data types. Though very useful, lots of care should be taken to test the C++ template functions during development. A well written c++ template will go a long way in saving time for programmers.

About The Author

Muthukumar

More articles can be found at http://www.codersource.net/.

This article was posted on October 16, 2004

by Muthukumar

When is Too Much Color Too Much?

When is Too Much Color Too Much?

by: Paul Hood

At the onset of creating a digital document for printing, you must have decided if you are going to use two or more colors for your type. It is important that you must have familiarized yourself with the basics of color and color combinations and its effect on the appearance of your text. Knowing beforehand pertinent knowledge can save you a great deal of energy. Not to mention headaches.

Lifetips states that ขWhen designing a digital document for printing, try not to use a build of more than two colors for your type. When a color is needed which uses more than 2 colors, this may cause colored drop shadows, due to registration. While in the design stage, try to pick a PMS which is built using only one or two colors.ข

The importance of having a sound plan as to what design you will follow throughout the project cannot be stressed enough and here Lifetips once again hits home. As it is, printing particularly small types in more than one color can be very difficult. Doing this will result in fuzzy or hazy images which is likely not what you had in mind. The best thing to do, as Lifetips says, is to make sure that you have made a plan and a good design for your print type.

Even the best of plans go awry, so if you are already there still are things that can be done to solve the problem. In cases when you have to print types in two or more color, be sure that the type to be colored is not smaller than 12 point. Small types ideally have to be printed in just one color. Larger types can be printed with two or more color provided that one of the colors be very light.

Above are sound tips that will be very useful for your printing tasks. Using the right color with the appropriate size of types will yield satisfying results. But then again, nothing beats a sound plan.

About The Author

Ariel Velasco goes by the author alias of Paul Hood. This author is into books and writing. Reading is an essential part of his life and this has lent a considerable influence in his writing. Well traveled and would always want to travel more. He loves learning more about people and their ways. Took up a Bachelor of Arts in Sociology to further this fascination and had a fulfilling educational experience having been exposed to a wide spectrum of people. Always ready for new opportunities to learn and have a great deal of interest in different fields of expertise.

For additional information about the article you may visit http://www.uprinting.com

[email protected]

This article was posted on February 03

by Paul Hood

Determining Visitor Types

Determining Visitor Types

by: Susan Friedmann

The trade show floor is full of different types of people with different agendas. Some people have specific goals for attending the show; others do not. As an exhibitor your observation and questioning skills will be your key to determining who may be a viable sales prospect. Familiarize yourself with the various visitor types likely to frequent the tradeshow floor.

1. Definites. If you have done a thorough job of preshow marketing, definite prospects and customers will visit your booth.

2. Demonstration Junkies. Watch out for passersby who are attracted to your booth by a demonstration or other activity. These could be valuable prospects or time wasters. Ask a few short, openended questions to find out.

3. Curiosity Cats. These types could be curious about anything – what exactly your company does, a graphic, who designed your booth, and so on. Do not spend too much time with someone who is just interested in the design and construction of your booth or intricate details about your graphics.

4. Paper Lovers. Some people love to collect literature or just take any piece of paper no matter what it is. Are they attending the show to research the market for a boss? If so, they may be an influencer worth pursuing.

5. Eyeballers. These types are usually extremely friendly; they smile and their whole body language says, ขplease talk to me.ข Questioning will determine whether or not they are prospects worth pursuing.

6. Jeopardy Gigolos. Winning contests is their passion. They are always ready, willing and able to drop a business card into a fishbowl for any kind of drawing. Contests that require more than just a business card to enter will help deter these types from finding their way onto your followup lists.

7. Keepsakers. Any kind of giveaway attracts these types. They may even want more than one for family, friends and colleagues. Keen questioning will ascertain if this visitor has potential.

8. The Disinterested. Some people in the crowd will simply not be interested in what your organization has to offer. They often let you know in no uncertain terms through their body language; for example, walking by purposely avoiding eye contact or chatting with a colleague. Waylaying these types will only upset them.

9. Hawks. These people attend shows for the sole purpose of selling you their products or services. Publication advertising representatives are a prime example. They are unlikely to be prospects, but you never know. If floor traffic is slow, it may be worth asking a few questions, if only to find out who they could refer you to.

10. Job Seekers. Trade shows are an excellent place to network and look for organizations who may have present or future job openings. As with Hawks, you may want to spend time with them during slow, unproductive periods.

11. Nonentities. These types could be underlings in their organization sent to do some specific research. Never underestimate them. They may be extremely strong influencers. In addition, they probably know whom in their organization you need to contact. Time spent with them could be invaluable.

12. Snoops. Beware of the competition! These types often give themselves away by knowing too much or asking precise questions. Make sure that you do more questioning than talking so that you lessen the chances of giving away valuable information.

About The Author

Written by Susan A. Friedmann,CSP, The Tradeshow Coach, Lake Placid, NY, author: ขMeeting & Event Planning for Dummies,ข working with companies to improve their meeting and event success through coaching, consulting and training. Go to http://www.thetradeshowcoach.com to sign up for a free copy of ExhibitSmart Tips of the Week.

[email protected]

This article was posted on August 26, 2004

by Susan Friedmann

Organizing Your Mailing Lists For Your Email Promo

Organizing Your Mailing Lists For Your Email Promotions

by: Mr.Kim Thiel

With all the safelists and different methods for using them, it can get hectic trying to come up with a good way to post to them. Most of all, it is important to remember if you did post to them. With a little forethought, you can set up a mailing system that will mail out your daily mailing in no time at all.
Aureate Group Mailer is a very common tool used today for mailing. All references will be for that program, but the methods used can be adapted to any mailing program.
We tend to look at the lists as having 4 types. Below is our break down of these types and how we post to them.
LIST TYPES
1.Web based CGI
You have no choice really but to put all these types of lists in a bookmark folder. You might name these: "SL Daily", "Monday mailing" etc., grouping each folder by when you can mail. Also putting the actual day for posting is better than putting 3 X a week etc.That way you don’t have to think when the third day was; just mail on the day listed. We give this method our highest ranking for being safe to mail to because you’re mailing from the list ownerกs site and the scripts, in most cases, won’t allow you to double post on the same day. Also, you don’t mail directly to the individual address.
2.Web based email lists of individual addresses
The most time consuming and unsafe to use is the list of individual addresses you copy from websites or email . We say unsafe, because it is our belief that when you are mailing to a direct address, it is easier to forget disclaimers, putting you at greater risk of reaching people on a bad day who may have forgotten they were on the list in the first place, and who do not know how to check their mail properties to track where and why your mail came to them. It is really simple for them to click "FORWARD" and send a spam complaint. THAT they CAN do!
We use Aureate Group Mailer for this list type, and make a group for each list. Modify each group to reflect the disclaimer the list host provides, and mark the name of the list as to when it can be sent. When you import the updated lists, Aureate will automatically remove duplicates, but will leave the addresses that have been removed, so always delete the old list before importing the new one.
This is an example of our list setup in Group Mail. It includes all the types of lists:

dailyThe List (a list that had to be copied and imported)
dailyKlub Kaos
dailyce12001 Egroups etc (lists that need a disclaimer on top
dailyce12002 Egroups etc use merge)
dailyce12001 OntopicMail
dailyce12002 OntopicMail
dailyseverlists (lists you post to a server with using one address
SundaySmart List server includes disclaimer)
SundayJaz List
SundayOntopicmail weekly
SundayEgroup Special weekly
Monday Money pro Mail Weekly
MondayRibnik 2 X Week

I need to mention that you must update your type 2 list each time you send it out, or you are tempting fate. People drop off the list all the time. Just because a list has had 250 members for 3 days, does not mean itกs the same 250 people. When someone asks to be removed, they expect to happen in 24 hrs. If you don’t update, you can easily spam someone.
3. List Servers These are lists hosted on a private server that has a list server program installed on it. Many hosting companies offer it with their hosting package. Look to see if they supply the disclaimer to the ads you send to that list. If they do, then you can group the lists in one group divided only by the email account you subscribed to the list with. Since you must use the same address you subscribed with, group according to that address. If they don’t supply the disclaimer,then create each list in its own group, according to the disclaimer.
Note: It does matter if the list owner says no disclaimer is needed. If they don’t append one to your post, then you must add one. Always give a reader of your ad the choice to opt out of the list. ALWAYS!
4. Optin Groups The Big 4 Separate these types of lists from the others because you want to make sure to include a disclaimer on top. Use address merge in the the disclaimer and send by individual send, because merge won’t work in bulk send. Also, divide them by email account subscribed to.
Accurate and efficient mailing benefits you enormously in two ways: First, you are saving time by setting up a system that makes it easy for you to remember what to mail next and to whom. Most importantly, however, is that it aids you in making a minimum of mistakes, thereby reducing your chances of offending a reader with perceived spam. As we all know by now, it is not your intent that defines spam, rather the readerกs perception. Hope this can be of use to you…..

About The Author

Mr.Kim Thiel

For more marketing tips, training, tools, and email marketing resources, visit the popular http://cyberearners.com/bonus.html work site for the small and homebased business owner where you will find 2500+ email resources for marketers.

This article was posted on February 4, 2002

by Mr.Kim Thiel