is_sorted.h
Go to the documentation of this file.
00001 #pragma once
00002 #ifndef LAMA_COMMON_IS_SORTED_H
00003 #define LAMA_COMMON_IS_SORTED_H
00004 
00005 namespace lama_common
00006 {
00007 
00014 template<class ForwardIt>
00015 inline bool is_sorted(ForwardIt first, ForwardIt last)
00016 {
00017   if (first != last)
00018   {
00019     ForwardIt next = first;
00020     while (++next != last)
00021     {
00022       if (*next < *first)
00023       {
00024         return false;
00025       }
00026       first = next;
00027     }
00028   }
00029   return true;
00030 }
00031 
00032 } /* namespace lama_common */
00033 
00034 #endif /* end of include guard: LAMA_COMMON_IS_SORTED_H */


lama_common
Author(s): Gaël Ecorchard , Karel Košnar , Vojtěch Vonásek
autogenerated on Thu Jun 6 2019 22:02:03