Close category search window
 

Compile time recursive objects in C++

Full text access may be available

To access full text, please use your member or institutional sign in.


This paper appears in:
Technology of Object-Oriented Languages, 1998. TOOLS 27. Proceedings
Date of Conference: 22-25 Sep 1998
Author(s): Jarvi, J.
Turku Centre for Comput. Sci.
Page(s): 66 - 77
Product Type: Conference Publications

Available Formats Non-Member Price Member Price
US$31.00 US$10.00
Learn how you can qualify for the best price for the item!
  • Email
  • Print
  • Rights And Permissions

Abstract

The article explores the possibilities of generic programming offered by the template features of C++. We define compile time recursive objects as instances of class templates which contain other instances of the same template as member variables. With such templates we can define containers that contain objects of arbitrary types, but where the type of each element is known at compile time. The structure of the container is therefore fixed. The technique mimics the polymorphism achieved with dynamic binding and inheritance using static binding and template specialisation. It is obviously less flexible but offers considerable performance gains at runtime. We give the template definitions for compile time recursive lists and explain how to perform operations on these lists. As an example application, we use compile time lists in the definition of templates for special sparse vectors and matrices. In these vectors and matrices, the sparseness pattern can be arbitrary but must be known at compile time. The tracking of zero and nonzero elements is performed at compile time. This allows the programmer to use abstract vector and matrix expressions and still reach performance equal to hand coded operations. This is possible since the compiler can locate the elementary expressions between zero entries and discard them entirely from the resulting code

Index Terms

Index Terms are available to subscribers and IEEE members.

 





Need Help?


IEEE Advancing Technology for Humanity About IEEE Xplore | Contact | Help | Terms of Use | Nondiscrimination Policy | Site Map | Privacy & Opting Out of Cookies

A non-profit organization, IEEE is the world's largest professional association for the advancement of technology.
© Copyright 2012 IEEE - All rights reserved. Use of this web site signifies your agreement to the terms and conditions.