Software Information |
|
C++ Function Templates
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/.
|
RELATED ARTICLES
Integrating Microsoft Great Plains Accounting/ERP: RMS, CRM, eCommerce, Lotus Domino ? overview Microsoft Business Solutions Great Plains has substantial market share among horizontal and vertical clientele in the USA, Canada (including French version for Quebec/Montreal), UK, Australia, New Zealand, Spanish speaking Latin and Central America, South Africa and Middle East. Nowadays ERP can not stay as it is off-the-shelf product ? it requires integration with Legacy or newly implemented systems, such as CRM, Retail Management applications, custom in-house made business systems (transportation/cargo tracking, etc). The tendency is that if company uses Microsoft-driven computer park (Windows domain, SQL Servers, MS Exchange) the rest of the ERP/CRM applications are Windows-oriented. However you can have successful bridge between non-Microsoft ERP and Great Plains: Oracle, IBM Lotus Notes/Domino, DB2 or others), usually it involves Java/CORBA/EJB/JSP type of expertise. Google Brings the Earth to Your Desktop Google Inc. has launched a new software package that allows you to see satellite images on your desktop. Lotus Notes Domino and Microsoft CRM Integration Well, even if the combination might look very unusual, we see the coexistence of these two systems, especially in large corporations, non-profit organizations. Technically Lotus Notes Domino has parallel structure, including Domino email server. Lotus is extremely flexible and you can program your own CRM or purchase CRM for Lotus, however Microsoft CRM has Microsoft SQL Server database and very simple Sales automation module. Let's look at the integration reasons and scenarios. Be sure that each specific case requires custom programming, tuning and support. IT Strategy for Midsize Business: Microsoft vs. Java, Great Plains & CRM Midsize business or non-profit organization should decide if one-vendor solution would be appropriate and the associated risk acceptable. In our opinion, balancing the risk of one-vendor-approach is not economically feasible and should be avoided. This means that you need to decide if you plan to be Microsoft-oriented or Java/Unix/Linux/Oracle oriented. In the case of Java direction ? you again have to further consider your options and if possible do not deploy too many systems from different vendors. Even if you host your systems with somebody else ? we think that in the future you might have a risk of complex data conversion from one system to another. In this small article we'll show you typical way if you follow Microsoft direction: Microsoft Business Solutions Great Plains and Microsoft CRM Helping Newbies Understand Professional Software The Windows registry is a huge database that ensures normal computer operation. Installing and uninstalling software can make your registry a mess, leading to decreased PC performance and causing computer crashes. Find out how you can fix this and other problems yourself. Microsoft CRM Integration with Microsoft Retail Management System (RMS) ? Overview Microsoft Client Relation Management system (Microsoft CRM) and Microsoft RMS are both Microsoft SQL Server based applications, however historically Microsoft was purchasing industry leading software applications, such as QuickSell which is now Microsoft RMS. So, RMS design fundamentals were minted a long time before Microsoft CRM. But, still integration between the two is straightforward and what you need is consultant, who is familiar with both systems structures and customization scenarios. Microsoft CRM is currently integrated with Microsoft Great Plains and will be integrated with Microsoft Navision in the close future, RMS integration is not planned to our knowledge, so you should seek third party solutions or create your own integration. We see the need for such the integration when you sell on account in RMS and have customer support call center automated with Microsoft CRM. Let us give you highlights: Microsoft Small Business Manager Customization Options - Overview Microsoft Business Solutions Small Business Manager is Great Plains Dexterity based application and successor and small business market niche version of Microsoft Great Plains. Microsoft Great Plains itself has variety of customization and integration tools: Integration Manager, VBA/Modifier, Great Plains Dexterity, SQL Server stored procedures to name a few. By one reason or another MBS decided to restrict Small Business Manager and do not provide VBA/Modifier, restricted Great Plains ReportWriter version and didn't include Great Plains Dexterity IDE installer on SBM CD. Great Plains Customization Upgrade? Overview For CIO/IT Director Around the same time Microsoft made its move with .Net introduction and tried to gain portion of cheaper databases market: Pervasive SQL/Btrieve, Ctree/Faircom - and launched free MSDE database program. General direction for all its accounting systems was chosen - Microsoft announced future releases of so called Microsoft suites: Microsoft Financial, Microsoft HR, Microsoft Logistics, Microsoft Manufacturing to name a few. However Microsoft did not announce which product (Great Plains, Solomon or Navision) will become the base or will be transformed into each specific suite. Al these suites will be integrated into web-based Microsoft Business Portal Free Preventive Maintenance Software While several preventive maintenance software manufacturers offer free trials for their products before charging a fee, some companies offer their products for free. Free preventive maintenance software is rare, and is sometimes less thorough than software that must be purchased, but it can be a good solution for a new or struggling business. Where to Find Free Fleet Maintenance Software Costs of fleet maintenance software can vary widely. It is generally expected that the fleet manager will look at the needs of the company to determine what software package is best suited for their particular needs. Depending upon the size of the company, number of vehicles to be maintained and services of the company, you may be able to locate free fleet management software for your needs. Start Developing Your Own Software Learning how to program software seems like a daunting task fit only for the geeks and nerds who lock themselves away in dark rooms staring at their monitors for days on end as they pour over thick manuals written largely in zeros and ones. Fortunately the reality is that it's not as complicated to make basic applications as people may think. If it were, the majority of nerds wouldn't be doing it because the defining factor of our kind is an inherent laziness. Why do you think we like computers? The heaviest thing we have to lift is a monitor and that's done fairly irregularly and for a very short period of time. Information Products: A Business Owners Best Friend We live in a post-industrial age where information is the coin of the realm. Knowledge is the most valuable asset that a business owns. For most businesses, that knowledge exists primarily in the heads of the people who work there. For entrepreneurs and sole practitioners, what's in their head usually is the business. That's both limiting and dangerous. Dreamweaver vs FrontPage There are two major WYSIWYG(What You See Is What You Get) editors available for beginners. These are: Microsoft FrontPage and Macromedia Dreamweaver. So the question is which one is better? Microsoft Great Plains PM: Payables Management Microsoft Business Solutions Great Plains is marketed for mid-size companies as well as Navision (which has very good positions in Europe and emerging markets where it can be easily localized). Microsoft CRM Development Microsoft CRM is CRM answer from Microsoft Business Solutions. Protect Your Most Vital Business Asset with Security Software Homeland security, airport security, Internet security �?" these days we�??re literally inundated with a need to protect ourselves and our property from the non-stop bombardment of potentially damaging attacks by unknown sources and entities lurking somewhere out there. Does your Company have Documentum? Are you lost in the mess of documents that get passed around your company, never knowing what the latest version is and which one you should work on without worrying if someone else has already made the same editions that you are making? Perhaps you have heard of collaboration software solutions such as Documentum to help your company manage its documents that are passed around. Documentum is a very good solution to this problem but is it the only one? In this article you will be presented with some basic information about the differences in collaboration software from Documentum and NextPage. Microsoft Great Plains Data Conversion ? Overview For Developer Looks like Microsoft Great Plains becomes more and more popular, partly because of Microsoft muscles behind it. Now it is targeted to the whole spectrum of horizontal and vertical market clientele. Small companies use Small Business Manager (which is based on the same technology ? Great Plains Dexterity dictionary and runtime), Great Plains Standard on MSDE is for small to midsize clients, and then Great Plains serves the rest of the market up to big corporations. Basic Tips and tricks for Windows XP Running Applications in Compatibility Mode With Windows XP, you can run programs as if though they were being run under a different operating system. (This is known as "emulation".) Simply right-click a shortcut, select "Properties" and then check "Run in compatibility mode" and select the operating system you wish to make the program believe it is being run under. This fools or tricks the program into thinking you are really using a previous version of Windows, such as NT, 2000, 98, or 95. This is especially useful for certain games that won't run properly. Be careful *not* to use this with certain system utilities, such as antivirus, defrag, registry, and disk tool applications. Can You Calculate Complex Financial Calculations? Are you a whiz at calculating financial information? Not the easy personal stuff, like figuring out your monthly mortgage based on a fixed interest rate for x number of years, or how much money you have available each month after all your bills are paid. (You can probably use your fingers to figure that one out!) |
home | site map |
© 2005 |