Boost logo

Boost :

From: Alexander Nasonov (alnsn_at_[hidden])
Date: 2006-11-29 15:24:51

Steven Watanabe wrote:
> typedef any_tuple<_1, _1, _2,
> where_<random_access_iterator<_1>, callable<_2, bool(deref_result<_1>,
> deref_result<_1>)> > > sort_args;
> void sort_impl(mpl::at<sort_args, _1>::type&, mpl::at<sort_args,
> _1>::type&, mpl::at<sort_args, _2>::type&);
> template<class Iter, class F>
> void sort(Iter begin, Iter end, F f) {
> sort_args args(begin, end, f);
> sort_impl(get<0>(args), get<1>(args), get<2>(args));
> }

I don't quite understand how it's connected to dynamic_any::any
objects. Does object 1 stores an iterator to a beginning of a sequence
while object 2 stores past-the-end of the sequence?

> Would such a class be useful?
> Any better ideas for the interface?
> The big problem is the amount of metaprograming needed.
> 10 operations were more than msvc 7.1 could handle with
> my version of dynamic_any::any<> and this is much worse.

Definitely. I think, it this case we should find a good balance
between compile-time and runtime. I don't like an interface where
functions for different arguments variantions are registred at
runtime, but if there is no other solution, I can accept it. But
in this case it would be better to start with multimethods library
and then use it for dynamic_any.

Originally, I wanted to get close to untyped languages where you
can multiply numbers and strings and things like this. This means
that you have a limited set of types (bool, integers, floats, chars,
strings and references to objects). This set can be bigger in C++
because you may want to handle references to different base classes
differently but it's still, I thought, can be enumerated in one
place. All combinations of 20 types gives 400 variants. It's big
for mpl::vector but I believe modern compilers can process typelists
of this length if a library is carefully crafted.

Alexander Nasonov
Nobody made a greater mistake than he who did nothing because he
could do only a little. -- Edmund Burke --
This quote is generated by: 
	/usr/pkg/bin/curl -L         \
	  | sed -e 's/^document\.write(.//' -e 's/.);$/ --/'  \
	        -e 's/<[^>]*>//g' -e 's/^More quotes from //' \
	  | fmt | tee ~/.signature-quote

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