
On 26/08/10 15:19, Jeffrey Lee Hellrung, Jr. wrote:
You can't get the size of a range at compile-time.
But you can define a trait or metafunction that tells you *whether* the range has a compile-time size (and, if so, then *what* that size is)
You might as well special case fusion sequences.
and go around specializing it for C arrays, Boost.Array, the Boost.Range adaptors, etc. E.g., a transformed range is statically sized iff it's underlying range is statically sized; a joined range is statically sized if *all* its underlying ranges are statically sized; etc.
Indeed, you could specialize all range adaptors to call the fusion equivalent when passed fusion sequences, but then it wouldn't be clear what the return type is, since an iterator adaptor and a fusion expression are quite different things. This is already a problem with ranges, as return types are not well documented (and sometimes are in a detail namespace...). This could be solved with a result_of namespace like fusion does.