Expression Templates in Ada

  • Alexandre Duret-Lutz
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2043)


High-order matrix or vector expressions tend to be penalized by the use of huge temporary variables. Expression templates is a C++ technique which can be used to avoid these temporaries, in a way that is transparent to the user. We present an Ada adaptation of this technique which — while not transparent — addresses the same efficiency issue as the original. We make intensive use of the signature idiom to combine packages together, and discuss its importance in generic programming. Finally, we express some concerns about generic programming in Ada.


Generic Programming Generic Package Matrix Expression Package Body Template Specialization 
These 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.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Luca Cardelli and Peter Wegner. On understanding types, data abstraction, and polymorphism. Computing Surveys, 17(4):471–522, December 1985.CrossRefGoogle Scholar
  2. 2.
    Alexandre Duret-Lutz, Thierry Géraud, and Akim Demaille. Design patterns for generic programming in C++. In Proceedings of the 6th USENIX Conference on Object-Oriented Technologies and Systems (COOTS’01), San Antonio, Texas, USA, July 2001. To appear.Google Scholar
  3. 3.
    Ulfar Erlingsson and Alexander V. Konstantinou. Implementing the C++ Standard Template Library in Ada 95. Technical Report TR96-3, CS Dept., Rensselaer Polytechnic Institute, Troy, NY, January 1996.Google Scholar
  4. 4.
    Geoffrey Furnish. Disambiguated glommable expression templates. Computers in Physics, 11(3):263–269, May/June 1997. Republished in [5].Google Scholar
  5. 5.
    Geoffrey Furnish. Disambiguated glommable expression templates. C++ report, May 2000.Google Scholar
  6. 6.
    Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides. Design patterns–Elements of reusable object-oriented software. Professional Computing Series. Addison Wesley, 1995.Google Scholar
  7. 7.
    Scott W. Haney. Beating the abstraction penalty in C++ using expression templates. Computers in Physics, 10(6):552–557, Nov/Dec 1996.Google Scholar
  8. 8.
    Intermetrics, Inc., Cambridge, Massachusetts. Ada 95 Rationale, January 1995.Google Scholar
  9. 9.
    Alexander V. Konstantinou, Ulfar Erlingsson, and David R. Musser. Ada standard generic library. source code, 1998.Google Scholar
  10. 10.
    Brian McNamara and Yannis Smaragdakis. Static interfaces in C++. In First Workshop on C++ Template Programming, Erfurt, Germany, October 10 2000.Google Scholar
  11. 11.
    David R. Musser, editor. Dagstuhl seminar on Generic Programming, SchloβDagstuhl, Wadern, Germany, April–May 1998.Google Scholar
  12. 12.
    David R. Musser and Alexandre A. Stepanov. Generic programming projects and open problems. 1998.Google Scholar
  13. 13.
    Nathan C. Myers. Traits: a new and useful template technique. C++ Report, 7(5):32–35, June 1995.Google Scholar
  14. 14.
    Jeremy Siek and Andrew Lumsdaine. Concept checking: Binding parametric polymorphism in C++. In First Workshop on C++ Template Programming, Erfurt, Germany, October 10 2000.Google Scholar
  15. 15.
    Alex Stepanov. Al Stevens Interviews Alex Stepanov. Dr. Dobb’s Journal, March 1995.Google Scholar
  16. 16.
    Alex Stepanov and Meng Lee. The Standard Template Library. Hewlett Packard Laboratories, 1501 Page Mill Road, Palo Alto, CA 94304, October 1995.Google Scholar
  17. 17.
    Todd Veldhuizen. Using C++ template metaprograms. C++ Report, 7(4):36–43, May 1995. Reprinted in C++ Gems, ed. Stanley Lippman.Google Scholar
  18. 18.
    Todd L. Veldhuizen. Expression templates. C++ Report, 7(5):26–31, June 1995.Google Scholar
  19. 19.
    Todd L. Veldhuizen. Using C++ trait classes for scientific computing, March 1996.Google Scholar
  20. 20.
    Todd L. Veldhuizen. Arrays in blitz++. In Proceedings of the 2nd International Scientific Computing in Object-Oriented Parallel Environments (ISCOPE’98), Lecture Notes in Computer Science. Springer-Verlag, 1998.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2001

Authors and Affiliations

  • Alexandre Duret-Lutz
    • 1
  1. 1.EPITA Research and Development LaboratoryLe Kremlin-Bicêtre cedexFrance

Personalised recommendations