Boost logo

Boost :

From: Doug Gregor (gregod_at_[hidden])
Date: 2001-01-13 21:03:10

On Saturday 13 January 2001 08:35, you wrote:
> Hi Doug,
> Thanks for the explanation.
> How about the case when the matrix size is a run-time value, instead
> of compile-time as in your example?

Our notion of literal tables can't handle run-time values. They were designed
to be analagous to C++ literals (int, float, string, bool, etc) for
high-level compiler optimizations and as such must be generated using only
static information.

However, Boost doesn't need the same functionality that literal tables were
designed for. Instead of literal tables, a one-way mapping from ID to value
could be used. Then, additional parameters could be specified at run-time:

template<typename Domain, int ID>
struct GetLiteral
  static Domain get() { /* ... */ }

This would allow something like:

template<typename T>
struct GetLiteral<Matrix<T>, 1>
  static Matrix<T> get(int rows, int cols) {
        return Matrix<T>(rows, cols, Matrix<T>::identity);

        Doug Gregor

Boost list run by bdawes at, gregod at, cpdaniel at, john at