NASA Logo

NTRS

NTRS - NASA Technical Reports Server

Back to Results
The Design of a Templated C++ Small Vector Class for Numerical ComputingWe describe the design and implementation of a templated C++ class for vectors. The vector class is templated both for vector length and vector component type; the vector length is fixed at template instantiation time. The vector implementation is such that for a vector of N components of type T, the total number of bytes required by the vector is equal to N * size of (T), where size of is the built-in C operator. The property of having a size no bigger than that required by the components themselves is key in many numerical computing applications, where one may allocate very large arrays of small, fixed-length vectors. In addition to the design trade-offs motivating our fixed-length vector design choice, we review some of the C++ template features essential to an efficient, succinct implementation. In particular, we highlight some of the standard C++ features, such as partial template specialization, that are not supported by all compilers currently. This report provides an inventory listing the relevant support currently provided by some key compilers, as well as test code one can use to verify compiler capabilities.
Document ID
20010081822
Acquisition Source
Ames Research Center
Document Type
Preprint (Draft being sent to journal)
Authors
Moran, Patrick J.
(Advanced Management Technology, Inc. Moffett Field, CA United States)
Date Acquired
September 7, 2013
Publication Date
June 20, 2000
Subject Category
Computer Programming And Software
Funding Number(s)
CONTRACT_GRANT: DTTS59-99-D00437
CONTRACT_GRANT: NASA Order A-61812-D
Distribution Limits
Public
Copyright
Work of the US Gov. Public Use Permitted.
No Preview Available