Skip to content
neurotempest edited this page Sep 11, 2014 · 2 revisions

Welcome to the wiki of the CodedProject::Sequence library!

This library implements a C++ container that can be used to store any type which represents numerical data, and allows numerical operations to be preformed (very efficiently using expression templates!) on whole containers (e.g. +,-,*,/,... etc.) so long as the types being stored support the operation being requested.

Think of it as an alternative to std::valarray, only without the egregious design decisions. (Ok, maybe we're being a little harsh on valarray, but there are some points which has given valarray a less than desirable reputation: For example, the fact that the fill constructor for a valarray takes its arguments in the opposite order from every other container in the STL, or that it's up to the library implementation whether or not to use expression templates for valarray's arithmetic operators - which, as far as we can from the sporadic history of valarray, was the whole reason for it's creation in the first place. We're not trying to start rumors that valarray should/will be deprecated, but we are saying that there are reasons why it lives in the 'Other' reference section on cpluplus.com rather than the 'Container' section, and, in our opinion, those reasons makes valarray not fit for purpose in certain circumstances.)

Aside from opinion and conjecture, here as some concrete reasons why CodedProject::Sequence is preferable to std::valarray:

  • It allows using any underlying (STL-compliant) data structure to store it's data. In effect, CodedProject::Sequence is just a wrapper for any other container in exactly the same way std::queue is a wrapper; the underlying data structure is specified as a template parameter.
  • CodedProject::Sequence is a fully STL-compliant container. (That is, so long as the underlying data structure is fully STL-compliant.)

Other reasons which may not be implemented yet but are at the top of the priority list (one supposes this act's as a sort of roadmap...):

  • Expression templates are (will be!) implemented for all operations involving CodedProject::Sequence.
  • The implementation of those expression templates is public, meaning that you can write your own operations which return expressions which can lazily evaluated in an efficient manner.

All in all, the CodedProject::Sequence is a toy which was created because we wanted to have a go at writing our own expression templates, and we thought we'd make it open source because (a) it's useful to have things version controlled, and (b) others might be able to use it. It you do find useful, great!, please let us know what for and how we can improve it! (Maybe even contribute!); if not, please don't moan about useless it is.

Clone this wiki locally