
Daniel James <daniel@calamity.org.uk> writes:
Arkadiy Vertleyb wrote:
"Daniel James" <daniel@calamity.org.uk> wrote
Using mpl views might be better. Currently the implementation works by passing a list/vector to encode and adding to it. Instead encode could just return the sequence for it's sub-type, which can then be combined using mpl::joint_view, or similar. Note that push_back<mpl::vector<...> > requires just one template instantiation. I am not sure why views are better. And views definitely don't provide constant-time lookup.
I didn't mean to suggest that they're better in that regard. If the lookup time proves to be an obstacle, then the sequence can be copied into a mpl::vector, or Peder's compile time variables. The real advantage is losing the extra template parameter, which might not make much of a difference at all. But it might make the code a bit cleaner and more 'functional'.
It's probably not worth your time looking into it. But I might have a go when you release your next version (so I'm not working against a moving target). And I'd like to wait for the new version of mpl.
Apparently it's already on the main trunk. -- Dave Abrahams Boost Consulting http://www.boost-consulting.com