[Cs3] CSIII question

Mikhail Nesterenko mikhail at cs.kent.edu
Wed Oct 12 16:25:34 EDT 2016


> 
> Does the compiler do anything for me to prevent mistakes passing the
> range of unsorted elements to the algorithm like merge() or
> binary_search()? Or is it just logical error that we have to be
> careful not to do that?
> 

I looked up the specification, for binary_search(), it states that
invalid arguments cause unspecified behavior. This includes unsorted
range.

For merge(), the spec does not say anything. Wich means that the
unsorted range behavior is undefined (by the standard).

thanks,
--
Mikhail


More information about the cs3 mailing list