
AMDG On 05/29/2011 03:05 PM, Robert Ramey wrote:
I'm working on a personal project based on fusion. This project builds a library on
I'm working on an experimental library which builds on fusion. As part of that I want to implement concept checking for this experimental library. Since this builds on fusion, I want to implement concept checking for fusion so my library can build on that. Since fusion seems clearly documented, I would hope that this would be a fairly straight forward exercise.
This will also give me a better feel for concept checking and archtypes.
Looking at fusion documentation on page: ..libs/fusion/doc/html/fusion/iterator/concepts/forward_iterator.html I find:
Expression Requirments ====================== next(i) ...
Meta Expressions ============ result_of::next<I>::type ...
Expression Semantics =============== next(i) - An iterator to the element following i ...
So the quesion is: Why is result_of::next<I>::type necessary? The expression symantics only make sense if next(i) if it returns the same type as it's argument. So why is the result_of::next<I>::type needed at all. That is won't it always be equal to I. If not, why not?
The type of next(i) is not the same as
the type of i. Every iterator to a fusion
sequence has a different type. For example,
for fusion::vector, the iterators could look
something like:
template
The question I have applies to other functions as well but next illustrates my question. specifially I have the same question regarding advance, and advance_c.
Also the espressions i == j should return a value convertible to bool. Then what is result_of::equal_to::type to be used for? distance raises similar quesions.
Actually, result_of::equal_to is used a lot more when implementing algorithms than operator==. equality for fusion iterators depends only on their types. distance can be computed at compile time.
I'm actually having quite a bit of difficulty with this task - the above quesions are only the easiest one to formulate.
In Christ, Steven Watanabe