Skip to content
Free planNo credit card requiredStart writing

Search 250 million research papers

Read the abstract, see who wrote it and who cites it, and get the citation in APA, MLA, Chicago or Harvard.

About 5,849 papers for “function templates”

Function templates

Apress eBooks · 2009

AbstractYou saw in Exploration 22 that the magic of overloading lets C++ implement an improved interface to the absolute value function. Instead, of three different names (abs, labs, and fabs), C++ has a single name for all three functions. Overloading helps the programmer who needs to call the abs function, but it doesn’t help the implementor much, who still has to write three separate functions that all look and act the same. Wouldn’t it be nice if the library author could write the abs function once instead of three times? After all, the three implementations are identical, differing only in the return type and parameter type. This Exploration introduces this style of programming, called generic programming.KeywordsLine NumberAngle BracketFunction ArgumentReturn TypeStandard LibraryThese keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Cited by 0

Function Templates

Ray Lischner · Apress eBooks · 2020

You saw in Exploration 25 that the magic of overloading lets C++ implement an improved interface to the absolute value function. Instead, of three different names (abs, labs, and fabs), C++ has a single name for all three functions. Overloading helps the programmer who needs to call the abs function, but it doesn’t help the implementer much, who still has to write three separate functions that all look and act the same. Wouldn’t it be nice if the library author could write the abs function once instead of three times? After all, the three implementations may be identical, differing only in the return type and parameter type. This Exploration introduces this style of programming, called generic programming.

Cited by 0

Function Templates

Ray Lischner · Apress eBooks · 2013

You saw in Exploration 24 that the magic of overloading lets C++ implement an improved interface to the absolute value function. Instead, of three different names (abs, labs, and fabs), C++ has a single name for all three functions. Overloading helps the programmer who needs to call the abs function, but it doesn’t help the implementer much, who still has to write three separate functions that all look and act the same. Wouldn’t it be nice if the library author could write the abs function once instead of three times? After all, the three implementations may be identical, differing only in the return type and parameter type. This Exploration introduces this style of programming, called generic programming.

Cited by 0

Function Templates

Ivor Horton, Peter Van Weert · Apress eBooks · 2023

You may have noticed that some of the overloaded functions in Ex8_15 consisted of exactly the same code. The only difference were the types that appear in the parameter list. It seems an unnecessary overhead to have to write the same code over and over, just because it has to work for different types. And indeed it is. In such situations you can write the code just once, as a function template. The Standard Library, for instance, makes heavy use of this feature to ensure that its functions work optimally with any type, including your own custom types, which of course the library cannot know about in advance. This chapter introduces the basics of defining your own function templates that work with any type you desire.

Cited by 0

Function Objects, Function Templates, and

Passage By Behavior · 2007

Passing functions and function objects to general purpose routines is a powerful abstraction mechanism that should be taught in freshman computer science. In C-I-I-, a "function" can be defined directly by the user or by a library or can be defined indirectly via operator() as a member function of a class. It is not obvious how to treat these "functions" in a uniform manner. We will show how function templates in C++ provide an elegant and teachable mechanism for passing entities with functional behavior as arguments to other functions.

Cited by 0

Symbolic representation with ordered function templates

Amit Kumar Goel, Gagan Hasteer, Randal E. Bryant · 2003

Binary Decision Diagrams (BDDs) often fail to exploit sharing between Boolean functions that differ only in their support variables. In a memory circuit, for example, the functions for the different bits of a word differ only in the data bit while the address decoding part of the function is identical. We present a symbolic representation approach using ordered function templates to exploit such regularity.Templates specify functionality without being bound to a specific set of variables. Functions are obtained by instantiating templates with a list of variables. We ensure canonicity of the representation by requiring that templates are normalized and argument lists are ordered. We also present algorithms for performing Boolean operations using this representation. Experiments with a prototype implementation built on top of CUDD indicate that function templates can dramatically reduce memory requirements for symbolic simulation of regular circuits.

Cited by 1

Function Objects, Function Templates, and Passage By Behavior in

Richard Rasala · 1997

Passing functions and function objects to general purpose routines is a powerful abstraction mechanism that should be taught in freshman computer science. In C++, a “function ” can be defined directly by the user or by a library or can be defined indirectly via operator() as a member function of a class. It is not obvious how to treat these “functions ” in a uniform manner. We will show how function templates in C++ provide an elegant and teachable mechanism for passing entities with functional behavior as arguments to other functions.

Cited by 0

Function objects, function templates, and passage by behavior in C++

Richard Rasala · 1997

Passing functions and function objects to general purpose routines is a powerful abstraction mechanism that should be taught in freshman computer science. In C++, a "function" can be defined directly by the user or by a library or can be defined indirectly via operator() as a member function of a class. It is not obvious how to treat these "functions" in a uniform manner. We will show how function templates in C++ provide an elegant and teachable mechanism for passing entities with functional behavior as arguments to other functions.

Cited by 10Open access

Function objects, function templates, and passage by behavior in C++

Richard Rasala · ACM SIGCSE Bulletin · 1997

Passing functions and function objects to general purpose routines is a powerful abstraction mechanism that should be taught in freshman computer science. In C++, a "function" can be defined directly by the user or by a library or can be defined indirectly via operator() as a member function of a class. It is not obvious how to treat these "functions" in a uniform manner. We will show how function templates in C++ provide an elegant and teachable mechanism for passing entities with functional behavior as arguments to other functions.

Cited by 12

Learn Drupal 14i: Templates and theme function

Johan Falk/NodeOne · Bulletin of Miscellaneous Information (Royal Gardens Kew)

This screencast is a part of the epic learning series "Four weeks of Drupal", chapter "Introduction to theming". You can view the full series at http://dev.nodeone.se/en/four-weeks-of-drupal. Please post any comments over there, or we won't see them. Sorry. --- This screencast shows that theme functions and template files are actually interchangable from a theme layer point of view. That means that it doesn't matter if you have a template file called field--body--page.tpl.php, or a theme function called MYTHEME_field__body__page. Both works for overriding the same thing! So, when do you want to use one or the other? * Template files are usually easier to read, override and change. If you expect that your theme function will be overridden a lot, consider making it a template file instead. * Template files should not contain much logic. If your theme output requires that, a theme function is probably a better approach. Or make sure to have preprocess function that make the necessary data easily available. * If everything else is equal, go for theme functions. They are slightly quicker to execute. --- This screencast is a part of the epic learning series "Four weeks of Drupal", chapter "Introduction to theming". You can view the full series at http://dev.nodeone.se/en/four-weeks-of-drupal. Please post any comments over there, or we won't see them. Sorry.

Cited by 0

Automatically identifying C++0x concepts in function templates

Andrew M. Sutton, Jonathan I. Maletic · 2008

An automated approach to the identification of C++0x concepts in function templates is described. Concepts are part of a new language feature appearing in the next standard for C++ (i.e., C++0x). Concept identification is the enumeration of constraints on the sets of types over which templates can be instantiated. The approach analyzes template source code and computes a set of viable concept instances describing the implied data abstraction of the template parameters. The approach is evaluated on generic algorithms defined in the C++ Standard Template Library (STL). The evaluation demonstrates the effectiveness of the approach. The approach can be used to assist in reengineering existing generic libraries to C++0x. Additionally, it has the potential to assist in the validation of concept hierarchies and interface definition in generic libraries.

Cited by 6