This project is read-only.

first operator

Jun 26, 2013 at 5:35 PM
A useful addition would be a "first" operator to complement "first_or_default". It would throw a sequence_empty_exception if necessary. One benefit over first_or_default is that the sequence elements would not need to be default constructible. Another benefit is that calling code that needs to throw an exception on an empty sequence doesn't need to do its own checking.

I coded this for my own project (since linqcpp is so nicely extensible), which was easy, since first_or_default is so similar. I'm happy to contribute the code if you'd like.
Jun 26, 2013 at 8:57 PM

Sure, do a pull-request and I can take a look at the code.


PS. The extensibility was one of the major motivational reasons for cpplinq in the first place so it's nice to see that people are using it.