skip to main content
article
Free Access

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

Published:01 March 1997Publication History
Skip Abstract Section

Abstract

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.

References

  1. 1 Barton, John. J. and Nackman, Lee R., Scientific alrl Engineering C++: An Introduction With Advanced Techniques and Examples,, Addison-Wesley, Reading, MA, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. 2 Ellis, Margaret A. and Stroustrup, Bjame, The Annotated C++ Reference Manual, ANSI Base Document, Addison-Wesley, Reading, MA, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. 3 Meyers, Scott, Effective C++: 50 Ways to Improve Your Programs and Designs, Addison-Wesley, Reading, /VIA, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. 4 Meyers, Scott, More Effective C++: 35 New Ways to Improve Your Programs and Designs, Addison-Wesley, Reading, MA, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. 5 Musser, David and Saini, Atul, STL Tutorial atzl Reference Guide: C++ Programming with the Standard Template Library, Addison-Wesley, Reading, MA, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. 6 Pattis, Richard, Teaching C++ as an Introductory Programming Language (an electronic newsletter), Vol 1::2, February 15, 1996. Contaet: [email protected],Google ScholarGoogle Scholar
  7. 7 Stroustrup, Bjarne, The C++ Programming Langttage, 2nd Edition, Addison-Wesley, Reading, MA, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. 8 Stroustrup, Bjarne, The Design and Evolution of C++, Addison-Wesley, Reading, MA, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

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

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      • Published in

        cover image ACM SIGCSE Bulletin
        ACM SIGCSE Bulletin  Volume 29, Issue 1
        March 1997
        388 pages
        ISSN:0097-8418
        DOI:10.1145/268085
        Issue’s Table of Contents
        • cover image ACM Conferences
          SIGCSE '97: Proceedings of the twenty-eighth SIGCSE technical symposium on Computer science education
          March 1997
          410 pages
          ISBN:0897918894
          DOI:10.1145/268084

        Copyright © 1997 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 1 March 1997

        Check for updates

        Qualifiers

        • article

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!