Skip to main content

Support for the Evolution of C++ Generic Functions

  • Conference paper
Software Language Engineering (SLE 2010)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 6563))

Included in the following conference series:

Abstract

The choice of requirements for an argument of a generic type or algorithm is a central design issue in generic programming. In the context of C++, a specification of requirements for a template argument or a set of template arguments is called a concept.

In this paper, we present a novel tool, TACE (template analysis and concept extraction), designed to help programmers understand the requirements that their code de facto imposes on arguments and help simplify and generalize those through comparisons with libraries of well-defined and precisely-specified concepts. TACE automatically extracts requirements from the body of function templates. These requirements are expressed using the notation and semantics developed by the ISO C++ standards committee. TACE converts implied requirements into concept definitions and compares them against concepts from a repository. Components of a well-defined library exhibit commonalities that allow us to detect problems by comparing requirements from many components: Design and implementation problems manifest themselves as minor variations in requirements. TACE points to source code that cannot be constrained by concepts and to code where small modifications would allow the use of less constraining concepts. For people who use a version of C++ with concept support, TACE can serve as a core engine for automated source code rejuvenation.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Abrahams, D., Gurtovoy, A.: C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond (C++ in Depth Series). Addison-Wesley Professional, Reading (2004)

    Google Scholar 

  2. Agesen, O., Palsberg, J., Schwartzbach, M.: Type inference of SELF. In: Wang, J. (ed.) ECOOP 1993. LNCS, vol. 707, pp. 247–267. Springer, Heidelberg (1993)

    Google Scholar 

  3. Alexandrescu, A.: Modern C++ design: generic programming and design patterns applied. Addison-Wesley Longman Publishing Co., Inc., Boston (2001)

    Google Scholar 

  4. An, P., Jula, A., Rus, S., Saunders, S., Smith, T., Tanase, G., Thomas, N., Amato, N., Rauchwerger, L.: STAPL: A standard template adaptive parallel C++ library. In: Dietz, H.G. (ed.) LCPC 2001. LNCS, vol. 2624, pp. 193–208. Springer, Heidelberg (2003)

    Chapter  Google Scholar 

  5. Austern, M.H.: Generic programming and the STL: using and extending the C++ Standard Template Library. Addison-Wesley Longman Publishing Co., Inc., Boston (1998)

    Google Scholar 

  6. Becker, P.: The C++ Standard Library Extensions: A Tutorial and Reference, 1st edn. Addison-Wesley Professional, Boston (2006)

    Google Scholar 

  7. Becker, P.: Working draft, standard for programming language C++. Tech. Rep. N2914 (June 2009)

    Google Scholar 

  8. Damas, L., Milner, R.: Principal type-schemes for functional programs. In: POPL 1982: Proceedings of the 9th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 207–212. ACM, New York (1982)

    Google Scholar 

  9. Dos Reis, G., Stroustrup, B.: A C++ formalism. Tech. Rep. N1885, JTC1/SC22/WG21 C++ Standards Committee (2005)

    Google Scholar 

  10. Dos Reis, G., Stroustrup, B.: Specifying C++ concepts. In: POPL 2006: Conference Record of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 295–308. ACM Press, New York (2006)

    Chapter  Google Scholar 

  11. Dos Reis, G., Stroustrup, B.: A principled, complete, and efficient representation of C++. In: Suzuki, M., Hong, H., Anai, H., Yap, C., Sato, Y., Yoshida, H. (eds.) The Joint Conference of ASCM 2009 and MACIS 2009, COE, Fukuoka, Japan. MI Lecture Note Series, vol. 22, pp. 151–166 (December 2009)

    Google Scholar 

  12. Dos Reis, G., Stroustrup, B., Meredith, A.: Axioms: Semantics aspects of C++ concepts. Tech. Rep. N2887, JTC1/SC22/WG21 C++ Standards Committee (June 2009)

    Google Scholar 

  13. Gregor, D., Järvi, J., Siek, J., Stroustrup, B., Dos Reis, G., Lumsdaine, A.: Concepts: linguistic support for generic programming in C++. In: OOPSLA 2006: Proceedings of the 21st Annual ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications, pp. 291–310. ACM Press, New York (2006)

    Chapter  Google Scholar 

  14. Gregor, D., Stroustrup, B., Siek, J., Widman, J.: Proposed wording for concepts (revision 4). Tech. Rep. N2501, JTC1/SC22/WG21 C++ Standards Committee (February 2008)

    Google Scholar 

  15. ISO/IEC 14882 International Standard: Programming languages: C++. American National Standards Institute (September 1998)

    Google Scholar 

  16. Järvi, J., Gregor, D., Willcock, J., Lumsdaine, A., Siek, J.: Algorithm specialization in generic programming: challenges of constrained generics in C++. In: PLDI 2006: Proceedings of the 2006 ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 272–282. ACM, New York (2006)

    Chapter  Google Scholar 

  17. Järvi, J., Marcus, M.A., Smith, J.N.: Library composition and adaptation using C++ concepts. In: GPCE 2007: Proceedings of the 6th International Conference on Generative Programming and Component Engineering, pp. 73–82. ACM Press, New York (2007)

    Google Scholar 

  18. Järvi, J., Willcock, J., Hinnant, H., Lumsdaine, A.: Function overloading based on arbitrary properties of types. C/C++ Users Journal 21(6), 25–32 (2003)

    Google Scholar 

  19. Peterson, J., Jones, M.: Implementing type classes. In: PLDI 1993: Proceedings of the ACM SIGPLAN 1993 Conference on Programming Language Design and Implementation, pp. 227–236. ACM Press, New York (1993)

    Chapter  Google Scholar 

  20. Siek, J., Lumsdaine, A.: Concept checking: Binding parametric polymorphism in C++. In: First Workshop on C++ Template Programming, Erfurt, Germany, October 10 (2000)

    Google Scholar 

  21. Siek, J.G., Lee, L.Q., Lumsdaine, A.: The Boost Graph Library: user guide and reference manual. Addison-Wesley Longman Publishing Co., Inc., Boston (2002)

    Google Scholar 

  22. Stepanov, A., McJones, P.: Elements of Programming. Addison-Wesley Professional, Reading (2009)

    Google Scholar 

  23. Stroustrup, B.: The design and evolution of C++. ACM Press/Addison-Wesley Publishing Co, New York, NY, USA (1994)

    Google Scholar 

  24. Stroustrup, B.: The C++ Programming Language. Addison-Wesley Longman Publishing Co., Inc., Boston (2000)

    MATH  Google Scholar 

  25. Stroustrup, B.: Abstraction and the C++ machine model. In: Wu, Z., Chen, C., Guo, M., Bu, J. (eds.) ICESS 2004. LNCS, vol. 3605, pp. 1–13. Springer, Heidelberg (2005)

    Chapter  Google Scholar 

  26. Stroustrup, B.: The C++0x “remove concept” decision. Dr. Dobb’s Journal 92 (August 2009) (republished with permission in Overload Journal July 2009)

    Google Scholar 

  27. Stroustrup, B.: Expounds on concepts and the future of C++. Interview with Danny Kalev (August 2009)

    Google Scholar 

  28. Sutton, A., Maletic, J.I.: Automatically identifying C++0x concepts in function templates. In: ICSM 2008: 24th IEEE International Conference on Software Maintenance, Beijing, China, pp. 57–66. IEEE, Los Alamitos (2008)

    Chapter  Google Scholar 

  29. Wadler, P., Blott, S.: How to make ad-hoc polymorphism less ad hoc. In: POPL 1989: Proceedings of the 16th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 60–76. ACM, New York (1989)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2011 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Pirkelbauer, P., Dechev, D., Stroustrup, B. (2011). Support for the Evolution of C++ Generic Functions. In: Malloy, B., Staab, S., van den Brand, M. (eds) Software Language Engineering. SLE 2010. Lecture Notes in Computer Science, vol 6563. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-19440-5_8

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-19440-5_8

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-19439-9

  • Online ISBN: 978-3-642-19440-5

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics