Boost logo

Boost :

From: Eric Friedman (ebf_at_[hidden])
Date: 2003-04-07 20:23:19

Gennadiy Rozental wrote:
> Could you clarify in which case loop-unrolling would provide O(1)
> complexity?

Assuming your assertion that a switch-based visitation algorithm is indeed
O(1), then the following loop-unrolling approach would provide O(1) for the
first N types:

  switch (which_) {
    case 1: visitor( reinterpret_cast<T1>( ... ) ); break;
    case N: visitor( reinterpret_cast<TN>( ... ) ); break;
        <some code to handle next N types>

Let me know if this resolves the issue.


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