Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-08-03 09:24:29

Andreas Huber <ahd6974-spamgroupstrap_at_[hidden]> writes:

> David Abrahams <dave <at>> writes:
>> If you're reversing the sequence, all your arguments about requiring
>> mutability for efficiency reasons are invalid. You might as well do
> I don't think so, I'm only reversing the sequence *after* performing other
> mutating operations on it. Here's an example from the current implementation
> (context_type_list is assembled from multiple InnerInitial lists):
> template< class CommonContext, class DestinationState >
> struct make_context_list
> {
> typedef typename mpl::reverse< typename mpl::push_front<
> typename mpl::erase<
> typename DestinationState::context_type_list,
> typename mpl::find<
> typename DestinationState::context_type_list,
> CommonContext
> >::type,
> typename mpl::end<
> typename DestinationState::context_type_list
> >::type
> >::type,
> DestinationState
> >::type >::type type;
> };
> [I know that this code needs improvement]

If you're erasing items at the end of a list<>, that's *very*
expensive! So, sorry to be blunt, but I maintain your arguments about
efficiency are invalid. Not to mention that they're not backed up by

Dave Abrahams
Boost Consulting

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