ACM Home Page
Please provide us with feedback. Feedback
Concepts: linguistic support for generic programming in C++
Full text PdfPdf (312 KB)
Source Conference on Object Oriented Programming Systems Languages and Applications archive
Proceedings of the 21st annual ACM SIGPLAN conference on Object-oriented programming systems, languages, and applications table of contents
Portland, Oregon, USA
SESSION: Generics table of contents
Pages: 291 - 310  
Year of Publication: 2006
ISBN:1-59593-348-4
Also published in ...
Authors
Douglas Gregor  Indiana University
Jaakko Järvi  Texas A&M University
Jeremy Siek  Rice University
Bjarne Stroustrup  Texas A&M University
Gabriel Dos Reis  Texas A&M University
Andrew Lumsdaine  Indiana University
Sponsors
SIGPLAN: ACM Special Interest Group on Programming Languages
ACM: Association for Computing Machinery
Publisher
ACM  New York, NY, USA
Bibliometrics
Downloads (6 Weeks): 16,   Downloads (12 Months): 172,   Citation Count: 6
Additional Information:

abstract   references   cited by   index terms   collaborative colleagues  

Tools and Actions: Review this Article  
Save this Article to a Binder    Display Formats: BibTex  EndNote ACM Ref   
DOI Bookmark: Use this link to bookmark this Article: http://doi.acm.org/10.1145/1167473.1167499
What is a DOI?

ABSTRACT

Generic programming has emerged as an important technique for the development of highly reusable and efficient software libraries. In C++, generic programming is enabled by the flexibility of templates, the C++ type parametrization mechanism. However, the power of templates comes with a price: generic (template) libraries can be more difficult to use and develop than non-template libraries and their misuse results in notoriously confusing error messages. As currently defined in C++98, templates are unconstrained, and type-checking of templates is performed late in the compilation process, i.e., after the use of a template has been combined with its definition. To improve the support for generic programming in C++, we introduce concepts to express the syntactic and semantic behavior of types and to constrain the type parameters in a C++ template. Using concepts, type-checking of template definitions is separated from their uses, thereby making templates easier to use and easier to compile. These improvements are achieved without limiting the flexibility of templates or decreasing their performance - in fact their expressive power is increased. This paper describes the language extensions supporting concepts, their use in the expression of the C++ Standard Template Library, and their implementation in the ConceptGCC compiler. Concepts are candidates for inclusion in the upcoming revision of the ISO C++ standard, C++0x.


REFERENCES

Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.

 
1
 
2
P. An, A. Jula, S. Rus, S. Saunders, T. Smith, G. Tanase, N. Thomas, N. Amato, and L. Rauchwerger. STAPL: A standard template adaptive parallel C++ library. In Int. Wkshp on Adv. Compiler Technology for High Perf. and Embedded Processors, page 10, July 2001.
 
3
 
4
G. Baumgartner, M. Jansche, and K. Läufer. Half & Half: Multiple Dispatch and Retroactive Abstraction for Java. Technical Report OSU-CISRC-5/01-TR08, Ohio State University, 2002.
 
5
 
6
Boost. Boost C++ L ibraries. http://www.boost.org/.
 
7
Alex Breuer, Peter Gottschling, Douglas Gregor, and Andrew Lumsdaine. Effecting parallel graph eigensolvers through library composition. In Performance Optimization for High-Level Languages and Libraries (POHLL), April 2006.
8
9
10
 
11
12
13
 
14
15
 
16
Ronald Garcia, Jaakko Järvi, Andrew Lumsdaine, Jeremy Siek, and Jeremiah Willcock. An extended comparative study of language support for generic programming. Journal of Functional Programming, 2005. Accepted.
 
17
GNU compiler collection. http://www.gnu.org/software/gcc/, 2005.
 
18
 
19
Douglas Gregor. ConceptGCC: Concept extensions for C++. http://www.generic-programming.org/software/ConceptGCC, 2005.
20
 
21
Douglas Gregor and Jeremy Siek. Implementing concepts. Technical Report N1848=05-0108, ISO/IEC JTC 1, Information Technology, Subcommittee 22, Programming Language C++, August 2005.
 
22
Douglas Gregor, Jeremy Siek, Jeremiah Willcock, Jaakko Järvi, Ronald Garcia, and Andrew Lumsdaine. Concepts for C++0x (revision 1). Technical Report N1849=05-0109, ISO/IEC JTC 1, Information Technology, Subcommittee 22, Programming Language C++, August 2005.
 
23
Douglas Gregor and Bjarne Stroustrup. Concepts. Technical Report N2042=06-0112, ISO/IEC JTC 1, Information Technology, Subcommittee 22, Programming Language C++, June 2006.
24
 
25
International Organization for Standardization. ISO/IEC 14882:1998: Programming languages - C++. Geneva, Switzerland, September 1998.
 
26
J. Järvi, B. Stroustrup, and G. Dos Reis. Decltype and auto (revision 4). Technical Report N1705=04-0145, ISO/IEC JTC 1, Information Technology, Subcommittee 22, Programming Language C++, September 2004. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1705.pdf.
27
 
28
Jaakko Järvi, Jeremiah Willcock, Howard Hinnant, and Andrew Lumsdaine. Function overloading based on arbitrary properties of types. C/C++ Users Journal, 21(6):25--32, June 2003.
29
 
30
 
31
D. Kapur and D. Musser. Tecton: a framework for specifying and verifying generic system components. Technical Report RPI--92--20, Department of Computer Science, Rensselaer Polytechnic Institute, Troy, New York 12180, July 1992.
 
32
 
33
K. Läufer, G. Baumgartner, and V. F. Russo. Safe structural conformance for Java. The Computer Journal, 43(6):469--481, 2000.
 
34
35
 
36
Mark Lillibridge. Translucent Sums: A Foundation for Higher-Order Module Systems. PhD thesis, Pittsburgh, PA, May 1997.
37
38
 
39
 
40
Microsoft Corporation. Generics in C#, September 2002. Part of the Gyro distribution of generics for .NET available at http://research.microsoft.com/projects/clrgen/.
 
41
 
42
43
 
44
 
45
 
46
Nathan Myers. A new and useful technique: "traits". C ++ Report, 7(5):32--35, June 1995.
 
47
Nathan C. Myers. Traits: a new and useful template technique. C ++ Report, June 1995.
48
 
49
Martin Odersky. The Scala language specification: Version 2.0, draft March 17, 2006. http://scala.epfl.ch/docu/files/ScalaReference.pdf, 2006.
 
50
Martin Odersky and al. An overview of the Scala programming language. Technical Report IC/2004/64, EPFL Lausanne, Switzerland, 2004.
51
 
52
 
53
Jeremy Siek, Douglas Gregor, Ronald Garcia, Jeremiah Willcock, Jaakko Järvi, and Andrew Lumsdaine. Concepts for C++0x. Technical Report N1758=05-0018, ISO/IEC JTC 1, Information Technology, Subcommittee 22, Programming Language C++, January 2005.
 
54
 
55
 
56
Jeremy Siek and Andrew Lumsdaine. Concept checking: Binding parametric polymorphism in C++. In First Workshop on C++ Template Programming, October 2000.
57
 
58
Jeremy Siek and Andrew Lumsdaine. Language requirements for large-scale generic libraries. In GPCE '05: Proceedings of the fourth international conference on Generative Programming and Component Engineering, September 2005. To appear.
 
59
 
60
Alexander A. Stepanov and Meng Lee. The Standard Template Library. Technical Report X3J16/94-0095, WG21/N0482, ISO Programming Language C++ Project, May 1994.
 
61
 
62
 
63
Bjarne Stroustrup and Gabriel Dos Reis. Concepts - design choices for template argument checking. Technical Report N1522=03-0105, ISO/IEC JTC 1, Information Technology, Subcommittee 22, Programming Language C++, October 2003. http://www.open-std.org/jtc1/sc22/wg21.
 
64
Bjarne Stroustrup and Gabriel Dos Reis. A concept design (rev. 1). Technical Report N1782=05-0042, ISO/IEC JTC 1, Information Technology, Subcommittee 22, Programming Language C++, May 2005.
 
65
Mathias Troyer and Prakash Dayal. The Iterative Eigensolver Template Library. http://www.comp-phys.org:16080/software/ietl/.
 
66
Todd Veldhuizen. Using C ++ template metaprograms. C++ Report, May 1995.
 
67
 
68
 
69
Todd L. Veldhuizen. Five compilation models for C++ templates. In First Workshop on C++ Template Programming, October 10 2000.
70


Collaborative Colleagues:
Douglas Gregor: colleagues
Jaakko Järvi: colleagues
Jeremy Siek: colleagues
Bjarne Stroustrup: colleagues
Gabriel Dos Reis: colleagues
Andrew Lumsdaine: colleagues