Programming with C++ concepts

This paper explores the definition, applications, and limitations of concepts and concept maps in C++, with a focus on library composition. We also compare and contrast concepts to adaptation mechanisms in other languages. Efficient, non-intrusive adaptation mechanisms are essential when adapting data structures to a library's API. Development with reusable components is a widely practiced method of building software. Components vary in form, ranging from source code to non-modifiable binary libraries. The Concepts language features, slated to appear in the next version of C++, have been designed with such compositions in mind, promising an improved ability to create generic, non-intrusive, efficient, and identity-preserving adapters. We report on two cases of data structure adaptation between different libraries, and illustrate best practices and idioms. First, we adapt GUI widgets from several libraries, with differing APIs, for use with a generic layout engine. We further develop this example to describe the run-time concept idiom, extending the applicability of concepts to domains where run-time polymorphism is required. Second, we compose an image processing library and a graph algorithm library, by making use of a transparent adaptation layer, enabling the efficient application of graph algorithms to the image processing domain. We use the adaptation layer to realize a few key algorithms, and report little or no performance degradation.

[1]  Jeremy G. Siek,et al.  The Boost Graph Library - User Guide and Reference Manual , 2001, C++ in-depth series.

[2]  Jeremy G. Siek,et al.  The Matrix Template Library: generic components for high-performance scientific computing , 1999, Comput. Sci. Eng..

[3]  John Vlissides,et al.  Proceedings of the 16th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications , 2001, OOPSLA 2001.

[4]  Jan Bosch,et al.  Framework integration problems, causes, solutions , 1999, CACM.

[5]  Simon L. Peyton Jones,et al.  Associated type synonyms , 2005, ICFP '05.

[6]  Gerald Baumgartner,et al.  Safe Structural Conformance for Java , 2000, Comput. J..

[7]  Jaakko Järvi,et al.  Concept-Controlled Polymorphism , 2003, GPCE.

[8]  Andrew Lumsdaine,et al.  Lifting sequential graph algorithms for distributed-memory parallel computation , 2005, OOPSLA '05.

[9]  Vassily Litvinov Contraint-based polymorphism in Cecil: towards a practical and static type system , 1998, OOPSLA '98.

[10]  Simon L. Peyton Jones,et al.  Imperative functional programming , 1993, POPL '93.

[11]  Kurt Mehlhorn,et al.  LEDA: a platform for combinatorial and geometric computing , 1997, CACM.

[12]  Philip Wadler,et al.  How to make ad-hoc polymorphism less ad hoc , 1989, POPL '89.

[13]  Geert-Jan Giezeman,et al.  On the design of CGAL a computational geometry algorithms library , 2000 .

[14]  William G. Griswold,et al.  An Overview of AspectJ , 2001, ECOOP.

[15]  Thomas R. Ioerger,et al.  TEXTAL: A Pattern Recognition System for Interpreting Electron Density Maps , 1999, ISMB.

[16]  Ralph Johnson,et al.  design patterns elements of reusable object oriented software , 2019 .

[17]  Andrew Lumsdaine,et al.  Effecting parallel graph eigensolvers through library composition , 2006, Proceedings 20th IEEE International Parallel & Distributed Processing Symposium.

[18]  Jitendra Malik,et al.  Normalized Cuts and Image Segmentation , 2000, IEEE Trans. Pattern Anal. Mach. Intell..

[19]  Bjarne Stroustrup,et al.  Concepts: linguistic support for generic programming in C++ , 2006, OOPSLA '06.

[20]  Mark A. Williams,et al.  The Bioinformatics Template Library—generic Components for Biocomputing , 2001 .

[21]  Kurt Mehlhorn,et al.  The LEDA Platform of Combinatorial and Geometric Computing , 1997, ICALP.

[22]  Douglas Gregor,et al.  Proposed Wording for Concepts (Revision 3) , 2007 .

[23]  Sven J. Dickinson,et al.  Introduction to the Special Section on Graph Algorithms in Computer Vision , 2001, IEEE Trans. Pattern Anal. Mach. Intell..

[24]  Uri Shani,et al.  Filling regions in binary raster images: A graph-theoretic approach , 1980, SIGGRAPH '80.

[25]  Thomas R. Ioerger,et al.  TEXTAL TM : Artificial Intelligence Techniques for Automated Protein Structure Determination. , 2003 .

[26]  Simon L. Peyton Jones,et al.  Associated types with class , 2005, POPL '05.

[27]  Bjarne Stroustrup,et al.  Runtime concepts for the C++ standard template library , 2008, SAC '08.

[28]  Mark P. Jones,et al.  Type Classes with Functional Dependencies , 2000, ESOP.

[29]  Richard Bellman,et al.  ON A ROUTING PROBLEM , 1958 .

[30]  Alexander A. Stepanov,et al.  C++ Standard Template Library , 2000 .

[31]  Jeremy G. Siek,et al.  Concept Checking: Binding Parametric Polymorphism in C++ , 2000 .

[32]  Jaakko Järvi,et al.  An extended comparative study of language support for generic programming , 2007, Journal of Functional Programming.

[33]  Jaakko Järvi,et al.  Algorithm specialization in generic programming: challenges of constrained generics in C++ , 2006, PLDI '06.

[34]  Alexander A. Stepanov,et al.  Generic Programming , 1988, ISSAC.

[35]  Clemens A. Szyperski,et al.  Component software - beyond object-oriented programming , 2002 .

[36]  Daniel P. Huttenlocher,et al.  Efficient Graph-Based Image Segmentation , 2004, International Journal of Computer Vision.

[37]  Nancy M. Amato,et al.  STAPL: An Adaptive, Generic Parallel C++ Library , 2001, LCPC.

[38]  Ohad Kammar,et al.  Algebraic foundations for effect-dependent optimisations , 2012, POPL '12.

[39]  Ralf Lämmel,et al.  Software extension and integration with type classes , 2006, GPCE '06.

[40]  Gul A. Agha,et al.  Concurrent object-oriented programming , 1993, CACM.

[41]  Martin Odersky,et al.  Polymorphic type inference and abstract data types , 1994, TOPL.

[42]  Simon Peyton Jones,et al.  Type classes: an exploration of the design space , 1997 .