edouarda/brigand

should the user be able to set the "not found" type ?

odinthenerd opened this issue · 2 comments

index_of currently returns no_such_type_ if the index is not found. This may require the user to write a lot of extra code if there is a good fallback. Lets say I want to make a "split_at_first_of":

    using index_of_first_match = index_if<l,pred<_1>>;
    using real_index_of_first_match = std::conditional<std::is_same<index_of_first_match, no_such_type_>::value, count<l>, index_of_first_match>::type;
    using r = split_at<l, real_index_of_first_match>;
//rather than
    using r = split_at<l, index_if<l,pred<_1>,wrap<l,count>>>;

If I could specify the fall back it would make my life much easier.

I think it's a sensible request indeed.

#193 is an implementation of this