From 15397fdd71d2cb6a852ea36dd87de9b80bdc3b26 Mon Sep 17 00:00:00 2001 From: Bolero-MURAKAMI Date: Thu, 22 Aug 2013 01:56:46 +0900 Subject: [PATCH] add doc:is_sorted, is_sorted_until --- docs/_sources/libs/sprout/algorithm/index.txt | 2 + .../libs/sprout/algorithm/is_sorted.txt | 46 +++++ .../libs/sprout/algorithm/is_sorted_until.txt | 48 +++++ .../libs/sprout/algorithm/mismatch.txt | 2 +- docs/libs/sprout/algorithm/index.html | 4 +- docs/libs/sprout/algorithm/is_sorted.html | 169 ++++++++++++++++++ .../sprout/algorithm/is_sorted_until.html | 161 +++++++++++++++++ docs/libs/sprout/algorithm/mismatch.html | 2 +- docs/libs/sprout/algorithm/search_n.html | 10 ++ docs/searchindex.js | 2 +- source/libs/sprout/algorithm/index.rst | 2 + source/libs/sprout/algorithm/is_sorted.rst | 46 +++++ .../libs/sprout/algorithm/is_sorted_until.rst | 48 +++++ 13 files changed, 537 insertions(+), 5 deletions(-) create mode 100644 docs/_sources/libs/sprout/algorithm/is_sorted.txt create mode 100644 docs/_sources/libs/sprout/algorithm/is_sorted_until.txt create mode 100644 docs/libs/sprout/algorithm/is_sorted.html create mode 100644 docs/libs/sprout/algorithm/is_sorted_until.html create mode 100644 source/libs/sprout/algorithm/is_sorted.rst create mode 100644 source/libs/sprout/algorithm/is_sorted_until.rst diff --git a/docs/_sources/libs/sprout/algorithm/index.txt b/docs/_sources/libs/sprout/algorithm/index.txt index 93313e17..f6e58c75 100644 --- a/docs/_sources/libs/sprout/algorithm/index.txt +++ b/docs/_sources/libs/sprout/algorithm/index.txt @@ -27,6 +27,8 @@ Sprout.Algorithm is_permutation search search_n + is_sorted + is_sorted_until .. _sprout-algorithm-non_modifying: ******************************************************************************* diff --git a/docs/_sources/libs/sprout/algorithm/is_sorted.txt b/docs/_sources/libs/sprout/algorithm/is_sorted.txt new file mode 100644 index 00000000..8e58f365 --- /dev/null +++ b/docs/_sources/libs/sprout/algorithm/is_sorted.txt @@ -0,0 +1,46 @@ +.. _sprout-algorithm-is_sorted: +############################################################################### +is_sorted +############################################################################### + +Interface +======================================== +.. sourcecode:: c++ + + template + inline SPROUT_CONSTEXPR bool + is_sorted(ForwardIterator first, ForwardIterator last); + + template + inline SPROUT_CONSTEXPR bool + is_sorted(ForwardIterator first, ForwardIterator last, Compare comp); + +Returns +======================================== + +| ``is_sorted_until(first, last) == last``, ``is_sorted_until(first, last, comp) == last`` + +Examples +======================================== +.. sourcecode:: c++ + + #include + #include + #include + using namespace sprout; + + SPROUT_STATIC_CONSTEXPR auto input = array{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}; + SPROUT_STATIC_CONSTEXPR auto result = sprout::is_sorted(begin(input), end(input)); + static_assert(result, "input is sorted."); + +Complexity +======================================== + +| Recursive function invocations in *O(logN)* (logarithmic) depth. + +Header +======================================== + +| ``sprout/algorithm/is_sorted.hpp`` +| Convenience header: ``sprout/algorithm.hpp`` + diff --git a/docs/_sources/libs/sprout/algorithm/is_sorted_until.txt b/docs/_sources/libs/sprout/algorithm/is_sorted_until.txt new file mode 100644 index 00000000..e3793900 --- /dev/null +++ b/docs/_sources/libs/sprout/algorithm/is_sorted_until.txt @@ -0,0 +1,48 @@ +.. _sprout-algorithm-is_sorted_until: +############################################################################### +is_sorted_until +############################################################################### + +Interface +======================================== +.. sourcecode:: c++ + + template + inline SPROUT_CONSTEXPR ForwardIterator + is_sorted_until(ForwardIterator first, ForwardIterator last); + + template + inline SPROUT_CONSTEXPR ForwardIterator + is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp); + +Returns +======================================== + +| If ``distance(first, last) < 2``, returns last. +| Otherwise, returns the last iterator i in [first,last] for which the range [first,i) is sorted. + +Examples +======================================== +.. sourcecode:: c++ + + #include + #include + #include + using namespace sprout; + + SPROUT_STATIC_CONSTEXPR auto input = array{{6, 7, 8, 8, 10, 1, 2, 3, 4, 5}}; + SPROUT_STATIC_CONSTEXPR auto result = sprout::is_sorted_until(begin(input), end(input)); + static_assert(result - begin(input) == 5, "input is sorted until position 5."); + +Complexity +======================================== + +| Linear. +| Recursive function invocations in *O(logN)* (logarithmic) depth. + +Header +======================================== + +| ``sprout/algorithm/is_sorted_until.hpp`` +| Convenience header: ``sprout/algorithm.hpp`` + diff --git a/docs/_sources/libs/sprout/algorithm/mismatch.txt b/docs/_sources/libs/sprout/algorithm/mismatch.txt index d43a1a71..9d32e60d 100644 --- a/docs/_sources/libs/sprout/algorithm/mismatch.txt +++ b/docs/_sources/libs/sprout/algorithm/mismatch.txt @@ -13,7 +13,7 @@ Interface template inline SPROUT_CONSTEXPR sprout::pair - mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2; + mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2); template inline SPROUT_CONSTEXPR sprout::pair diff --git a/docs/libs/sprout/algorithm/index.html b/docs/libs/sprout/algorithm/index.html index d3f50fda..994c28fe 100644 --- a/docs/libs/sprout/algorithm/index.html +++ b/docs/libs/sprout/algorithm/index.html @@ -78,8 +78,8 @@

Sorting

    -
  • is_sorted
  • -
  • is_sorted_until
  • +
  • is_sorted
  • +
  • is_sorted_until
  • is_increasing
  • is_decreasing
  • is_strictly_increasing
  • diff --git a/docs/libs/sprout/algorithm/is_sorted.html b/docs/libs/sprout/algorithm/is_sorted.html new file mode 100644 index 00000000..0714ef29 --- /dev/null +++ b/docs/libs/sprout/algorithm/is_sorted.html @@ -0,0 +1,169 @@ + + + + + + + is_sorted — Sprout v1.0 documentation + + + + + + + + + + + + + +
    +
    +
    +
    + +
    +

    is_sorted

    +
    +

    Interface

    +
    template<typename ForwardIterator>
    +inline SPROUT_CONSTEXPR bool
    +is_sorted(ForwardIterator first, ForwardIterator last);
    +
    +template<typename ForwardIterator, typename Compare>
    +inline SPROUT_CONSTEXPR bool
    +is_sorted(ForwardIterator first, ForwardIterator last, Compare comp);
    +
    +
    +
    +
    +

    Returns

    +
    +
    is_sorted_until(first, last) == last, is_sorted_until(first, last, comp) == last
    +
    +
    +
    +

    Examples

    +
    #include <sprout/algorithm/is_sorted.hpp>
    +#include <sprout/array.hpp>
    +#include <sprout/container.hpp>
    +using namespace sprout;
    +
    +SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
    +SPROUT_STATIC_CONSTEXPR auto result = sprout::is_sorted(begin(input), end(input));
    +static_assert(result, "input is sorted.");
    +
    +
    +
    +
    +

    Complexity

    +
    +
    Recursive function invocations in O(logN) (logarithmic) depth.
    +
    +
    + +
    + + +
    +
    +
    +
    +
    +

    Table Of Contents

    + + +

    Previous topic

    +

    search_n

    +

    Next topic

    +

    is_sorted_until

    +

    This Page

    + + + +
    +
    +
    +
    + + + + \ No newline at end of file diff --git a/docs/libs/sprout/algorithm/is_sorted_until.html b/docs/libs/sprout/algorithm/is_sorted_until.html new file mode 100644 index 00000000..1311cdf7 --- /dev/null +++ b/docs/libs/sprout/algorithm/is_sorted_until.html @@ -0,0 +1,161 @@ + + + + + + + is_sorted_until — Sprout v1.0 documentation + + + + + + + + + + + + +
    +
    +
    +
    + +
    +

    is_sorted_until

    +
    +

    Interface

    +
    template<typename ForwardIterator>
    +inline SPROUT_CONSTEXPR ForwardIterator
    +is_sorted_until(ForwardIterator first, ForwardIterator last);
    +
    +template<typename ForwardIterator, typename Compare>
    +inline SPROUT_CONSTEXPR ForwardIterator
    +is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp);
    +
    +
    +
    +
    +

    Returns

    +
    +
    If distance(first, last) < 2, returns last.
    +
    Otherwise, returns the last iterator i in [first,last] for which the range [first,i) is sorted.
    +
    +
    +
    +

    Examples

    +
    #include <sprout/algorithm/is_sorted_until.hpp>
    +#include <sprout/array.hpp>
    +#include <sprout/container.hpp>
    +using namespace sprout;
    +
    +SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{6, 7, 8, 8, 10, 1, 2, 3, 4, 5}};
    +SPROUT_STATIC_CONSTEXPR auto result = sprout::is_sorted_until(begin(input), end(input));
    +static_assert(result - begin(input) == 5, "input is sorted until position 5.");
    +
    +
    +
    +
    +

    Complexity

    +
    +
    Linear.
    +
    Recursive function invocations in O(logN) (logarithmic) depth.
    +
    +
    + +
    + + +
    +
    +
    +
    +
    +

    Table Of Contents

    + + +

    Previous topic

    +

    is_sorted

    +

    This Page

    + + + +
    +
    +
    +
    + + + + \ No newline at end of file diff --git a/docs/libs/sprout/algorithm/mismatch.html b/docs/libs/sprout/algorithm/mismatch.html index 1b6a5301..490a8ca8 100644 --- a/docs/libs/sprout/algorithm/mismatch.html +++ b/docs/libs/sprout/algorithm/mismatch.html @@ -59,7 +59,7 @@ template<typename InputIterator1, typename InputIterator2> inline SPROUT_CONSTEXPR sprout::pair<InputIterator1, InputIterator2> -mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2; +mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2); template<typename InputIterator1, typename InputIterator2> inline SPROUT_CONSTEXPR sprout::pair<InputIterator1, InputIterator2> diff --git a/docs/libs/sprout/algorithm/search_n.html b/docs/libs/sprout/algorithm/search_n.html index add71490..315fe936 100644 --- a/docs/libs/sprout/algorithm/search_n.html +++ b/docs/libs/sprout/algorithm/search_n.html @@ -21,6 +21,7 @@ + @@ -30,6 +31,9 @@
  • index
  • +
  • + next |
  • previous |
  • @@ -131,6 +135,9 @@

    Previous topic

    search

    +

    Next topic

    +

    is_sorted

    This Page

    • index
    • +
    • + next |
    • previous |
    • diff --git a/docs/searchindex.js b/docs/searchindex.js index 93fa259f..94ab47f2 100644 --- a/docs/searchindex.js +++ b/docs/searchindex.js @@ -1 +1 @@ -Search.setIndex({desctypes:{},terms:{logarithm:[0,20,12,1,21,5,6,3,15,8,23,16,17,18,24,2,25,9,7,10,26],any_of:[11,1],all:[6,10],distanc:5,set:3,c_arrai:14,less:[18,8,10,24],sprout:[22,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,2,20,21,23,24,25,0,26],random:[5,0,13],rbegin:14,all_of:[11,10],accompani:13,through:13,binarypred:[0,5,3,8,16,18,25,9],follow:[0,12,21,3,8,16,18,24,25,9,7,26],pointer:14,find:[11,12,3,8,16,18],find_if:[11,26],is_strictly_increas:11,content:4,onli:[14,23,2,13],inlin:[22,1,3,5,6,7,8,9,10,0,12,15,16,17,18,2,20,21,23,24,25,26],"const":[22,12,21,14,6,15,17,18,2],miscellan:19,copyright:[4,13],is_sort:11,fix:19,binary_search:11,blog:13,exposit:14,requir:[5,0,18],under:13,mail:13,subsequ:[16,18,8],is_strictly_decreas:11,arrai:[22,1,2,3,5,6,7,8,9,10,0,12,14,15,16,17,18,19,20,21,23,24,25,26],match:3,applic:[0,20,12,1,21,5,6,3,15,8,23,16,17,18,24,2,25,9,7,10,26],non:[11,22,18],license_1_0:13,"return":[0,20,12,1,21,5,6,3,15,8,23,16,17,18,24,2,25,9,7,10,26],string:19,murakami:13,fals:[0,20,1,5,6,15,23,17,2,10],auto:[0,20,12,1,21,5,6,3,15,8,23,16,17,18,24,2,25,9,7,10,26],is_sorted_until:11,clang:13,number:[7,21,13],range_adaptor:19,is_increas:11,front:14,none_of:[11,20],compliant:19,recurs:[0,20,12,1,21,5,6,3,15,8,23,16,17,18,24,2,25,9,7,10,26],min_el:11,lexicographical_compar:11,document:[4,13],like:19,specif:19,one_of_equ:[11,2],list:[5,0,25,19],synthes:[19,13],iter:[1,2,3,5,6,7,8,9,10,0,12,14,15,16,17,18,19,20,21,23,24,25,26],const_refer:14,mode:13,each:[9,13],pars:[19,13],found:[12,3,8,16,18,24,25,9,26],path:13,elem:14,where:[5,9],page:[4,13],compil:[4,13],adjacent_find:[11,9],www:13,find_end:[11,16],version:13,twitter:13,is_permut:[11,5],some:3,back:14,range_numer:19,minmax:11,see:13,last1:[0,5,3,8,16,25],integ:[16,18,8],domain:19,last2:[0,5,3,8,16,25],logn:[0,20,12,1,21,5,6,3,15,8,23,16,17,18,24,2,25,9,7,10,26],any_of_equ:[11,15],odd:7,librari:[4,19,13],integr:18,compat:19,index:4,txt:13,slideshar:13,neg:18,brief:13,all_of_equ:[11,6],categori:19,inputiterator1:[0,3,25],inputiterator2:[0,25],mathemat:19,const_point:14,sequenc:[11,16,18,8,19],nonempti:9,condit:[0,12,21,3,8,16,18,24,25,9,7,26],net:13,size:[14,18,19],boost:13,refer:14,value_typ:14,forwarditerator2:[5,16,3,8],forwarditerator1:[5,16,8],numer:19,gener:19,contain:[1,2,3,5,6,7,8,9,10,0,12,13,15,16,17,18,19,20,21,23,24,25,26],tristate_lexicographical_compar:11,effect:[16,3,18,8],cbegin:14,constexpr:13,base:13,bitset:19,otherwis:[0,20,1,5,6,15,8,23,17,2,10],org:13,modifi:[11,14],genyamurakami:13,valu:[12,21,5,6,3,15,8,16,14,17,18,2,9],both:9,search:[11,4,8],last:[20,12,1,21,6,7,15,23,16,17,18,24,2,9,10,26],upper_bound:11,most:[0,20,12,1,6,3,15,8,23,16,17,18,24,2,25,10,26],equal:[11,0,12,21,5,6,3,15,8,16,17,18,2,9],greater:[20,1,23,26],static_assert:[0,20,12,1,21,5,6,3,15,8,23,16,17,18,24,2,25,9,7,10,26],is_heap_until:11,range_algorithm:19,ptrdiff_t:14,implement:14,bolero:13,com:13,support:[4,19,13],search_n:[11,18],oper:[11,14],softwar:13,rang:[0,20,12,1,21,5,6,3,15,8,23,16,17,18,24,2,25,9,7,10,26],declval:14,point:13,modul:4,genya:13,forwarditer:[18,9],header:[0,1,3,5,6,7,8,14,9,10,11,12,13,22,15,16,17,18,2,20,21,23,24,25,26],permut:5,fill:14,empti:[20,1,14,6,3,15,8,23,16,17,2,10],linux:13,max_el:11,instal:[4,13],minmax_el:11,lexicograph:11,inputiter:[20,12,1,21,6,7,15,23,17,24,2,10,26],preprocessor:19,bind2nd:[20,1,7,23,24,10,26],given:[5,0,25],from:[12,21,3,8,16,18,24,9,7,26],would:5,pred:[0,20,1,5,3,8,23,16,18,24,25,9,7,10,26],licens:13,contact:13,capac:14,construct:14,bool:[0,20,1,5,6,15,23,14,17,2,10],websit:13,start:13,adjac:9,bolero_murakami:13,includ:[0,20,12,1,21,5,6,3,15,8,23,16,17,18,24,2,25,9,7,10,26],find_first_of:[11,3],second:25,interfac:[22,1,3,5,6,7,8,9,10,0,12,14,15,16,17,18,2,20,21,23,24,25,26],conveni:[1,3,5,6,7,8,9,10,0,12,14,15,16,17,18,2,20,21,23,24,25,26],type:[14,18],individu:13,cend:14,swap:[14,22],"function":[22,1,2,3,5,6,7,8,9,10,0,12,14,15,16,17,18,19,20,21,23,24,25,26],project:[4,13],option:19,comparison:11,namespac:[0,20,12,1,21,5,6,3,15,8,23,16,17,18,24,2,25,9,7,10,26],tupl:19,copi:[14,13],mismatch:[11,25],metaprogram:19,ani:[16,18,1,15,8],std:[14,22,7,21],link:13,indic:4,sprout_noexcept_expr:[14,22],iterator_trait:[7,21],first1:[0,5,3,8,16,25],first2:[0,5,3,8,16,25],hold:[0,12,21,3,8,16,18,24,25,9,7,26],"true":[0,20,1,5,6,15,23,17,2,10],than:[20,1,8,23,18,24,10,26],count:[11,7,18,21],none:[20,17],input:[20,12,1,21,6,7,15,23,17,24,2,9,10,26],stl:19,hpp:[0,1,3,5,6,7,8,14,9,10,11,12,22,15,16,17,18,2,20,21,23,24,25,26],access:[5,0,14],maximum:11,structur:19,const_reverse_iter:14,is_decreas:11,defin:14,sprout_constexpr:[22,1,3,5,6,7,8,9,10,0,12,14,15,16,17,18,2,20,21,23,24,25,26],minimum:11,below:[5,0,25],store:19,crend:14,posit:[12,3,8,16,18,24,25,9,26],meet:[5,0],invoc:[0,20,12,1,21,5,6,3,15,8,23,16,17,18,24,2,25,9,7,10,26],other:[9,13],arr:22,none_of_equ:[11,17],result:[0,20,12,1,21,5,6,3,15,8,23,16,17,18,24,2,25,9,7,10,26],input2:[0,5,3,8,16,25],sort:11,input1:[0,12,5,3,8,16,18,24,25,26],constant:14,rend:14,give:13,"int":[0,20,12,1,21,5,6,3,15,8,23,16,17,18,24,2,25,9,7,10,26],can:13,argument:[5,0,25],templat:[22,1,2,3,5,6,7,8,9,10,0,12,14,15,16,17,18,19,20,21,23,24,25,26],rai:[19,13],typedef:14,exist:5,hatena:13,file:13,tabl:4,everi:[0,6,17,20,10],clamp:11,predic:[0,20,12,1,21,5,6,3,15,8,23,16,17,18,24,2,25,9,7,10,26],worst:5,count_if:[11,7],denot:[5,0,25],to_arrai:22,end:[1,3,5,6,7,8,9,10,0,12,14,15,16,17,18,2,20,21,23,24,25,26],welcom:[4,13],lib:13,author:[4,13],alphabet:19,nonneg:[16,8],depth:[0,20,12,1,21,5,6,3,15,8,23,16,17,18,24,2,25,9,7,10,26],static_s:14,data:[14,19],member:[14,22],binari:11,complex:[0,20,12,1,21,5,6,3,15,8,23,16,17,18,24,2,25,9,7,10,26],find_if_not:[11,24],modulu:7,which:[12,21,13,7,24,25,9,26],lower_bound:11,difference_typ:[14,7,21],size_t:[14,22],equal_rang:11,"void":[14,22],sprout_noexcept:14,sprout_static_constexpr:[1,3,5,6,7,8,9,10,0,12,14,15,16,17,18,2,20,21,23,24,25,26],begin:[1,3,5,6,7,8,9,10,0,12,14,15,16,17,18,2,20,21,23,24,25,26],http:13,distribut:13,trace:[19,13],shall:18,max:11,"class":[14,22,19],object:19,variant:19,gcc:13,size_typ:14,initi:14,max_siz:14,typenam:[22,1,3,5,6,7,8,9,10,0,12,14,15,16,17,18,2,20,21,23,24,25,26],pair:25,crbegin:14,const_iter:14,one_of:[11,23],heap:11,remark:[5,0,25],exactli:[5,7,9,21],github:13,algorithm:[0,1,2,3,5,6,7,8,9,10,11,12,13,15,16,17,18,19,20,21,23,24,25,26],reverse_iter:14,directori:13,min:[11,0,25,9],descript:[14,13],correspond:[0,12,21,5,3,8,16,18,24,25,9,7,26],assign:14,is_heap:11,exampl:[0,20,12,1,21,5,6,3,15,8,23,16,17,18,24,2,25,9,7,10,26],thi:13,destroi:14,facebook:13,element:[12,21,5,3,14,24,9,7,26],first:[20,12,1,21,6,3,15,8,23,17,18,24,2,25,9,7,10,26],convert:18},titles:["equal","any_of","one_of_equal","find_first_of","Welcome to Sprout’s documentation!","is_permutation","all_of_equal","count_if","search","adjacent_find","all_of","Sprout.Algorithm","find","Sprout C++ Libraries","Class template array","any_of_equal","find_end","none_of_equal","search_n","Libraries","none_of","count","Sprout.Array","one_of","find_if_not","mismatch","find_if"],modules:{},descrefs:{},filenames:["libs/sprout/algorithm/equal","libs/sprout/algorithm/any_of","libs/sprout/algorithm/one_of_equal","libs/sprout/algorithm/find_first_of","index","libs/sprout/algorithm/is_permutation","libs/sprout/algorithm/all_of_equal","libs/sprout/algorithm/count_if","libs/sprout/algorithm/search","libs/sprout/algorithm/adjacent_find","libs/sprout/algorithm/all_of","libs/sprout/algorithm/index","libs/sprout/algorithm/find","libs/index","libs/sprout/array/array/index","libs/sprout/algorithm/any_of_equal","libs/sprout/algorithm/find_end","libs/sprout/algorithm/none_of_equal","libs/sprout/algorithm/search_n","libs/libraries","libs/sprout/algorithm/none_of","libs/sprout/algorithm/count","libs/sprout/array/index","libs/sprout/algorithm/one_of","libs/sprout/algorithm/find_if_not","libs/sprout/algorithm/mismatch","libs/sprout/algorithm/find_if"]}) \ No newline at end of file +Search.setIndex({desctypes:{},terms:{logarithm:[1,3,4,5,7,8,9,10,11,12,0,14,17,18,19,20,2,22,23,25,26,27,28],any_of:[13,1],all:[8,12],distanc:[7,5],set:3,c_arrai:16,less:[20,10,12,26],sprout:[0,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,2,22,23,24,25,26,27,28],random:[7,0,15],rbegin:16,all_of:[13,12],accompani:15,through:15,binarypred:[0,7,3,10,18,20,27,11],follow:[0,14,23,3,10,18,20,26,27,11,9,28],pointer:16,find:[13,14,3,10,18,20],find_if:[13,28],is_strictly_increas:13,content:6,onli:[16,25,2,15],inlin:[24,1,3,4,5,7,8,9,10,11,12,0,14,17,18,19,20,2,22,23,25,26,27,28],"const":[24,14,23,16,8,17,19,20,2],miscellan:21,copyright:[6,15],is_sort:[13,4],fix:21,binary_search:13,blog:15,forwarditerator2:[7,18,3,10],exposit:16,requir:[7,0,20],under:15,mail:15,subsequ:[18,20,10],is_strictly_decreas:13,arrai:[24,1,2,3,4,5,7,8,9,10,11,12,0,14,16,17,18,19,20,21,22,23,25,26,27,28],match:3,applic:[0,22,14,1,23,7,8,3,17,10,25,18,19,20,26,2,27,11,9,12,28],non:[13,24,20],license_1_0:15,"return":[1,3,4,5,7,8,9,10,11,12,0,14,17,18,19,20,2,22,23,25,26,27,28],string:21,murakami:15,fals:[0,22,1,7,8,17,25,19,2,12],auto:[1,3,4,5,7,8,9,10,11,12,0,14,17,18,19,20,2,22,23,25,26,27,28],is_sorted_until:[13,4,5],clang:15,number:[9,23,15],range_adaptor:21,is_increas:13,front:16,none_of:[13,22],compliant:21,recurs:[1,3,4,5,7,8,9,10,11,12,0,14,17,18,19,20,2,22,23,25,26,27,28],min_el:13,lexicographical_compar:13,document:[6,15],like:21,specif:21,one_of_equ:[13,2],list:[7,0,27,21],synthes:[21,15],iter:[1,2,3,5,7,8,9,10,11,12,0,14,16,17,18,19,20,21,22,23,25,26,27,28],const_refer:16,mode:15,each:[11,15],pars:[21,15],found:[14,3,10,18,20,26,27,11,28],path:15,elem:16,where:[7,11],page:[6,15],compil:[6,15],adjacent_find:[13,11],www:15,find_end:[13,18],version:15,twitter:15,is_permut:[13,7],some:3,back:16,range_numer:21,minmax:13,see:15,last1:[0,7,3,10,18,27],integ:[18,20,10],domain:21,last2:[0,7,3,10,18,27],logn:[1,3,4,5,7,8,9,10,11,12,0,14,17,18,19,20,2,22,23,25,26,27,28],any_of_equ:[13,17],odd:9,librari:[6,21,15],integr:20,compat:21,index:6,txt:15,slideshar:15,neg:20,brief:15,all_of_equ:[13,8],categori:21,inputiterator1:[0,3,27],inputiterator2:[0,27],mathemat:21,const_point:16,sequenc:[13,18,20,10,21],nonempti:11,condit:[0,14,23,3,10,18,20,26,27,11,9,28],net:15,size:[16,20,21],boost:15,refer:16,value_typ:16,linear:5,forwarditerator1:[7,18,10],numer:21,comp:[4,5],gener:21,contain:[1,2,3,4,5,7,8,9,10,11,12,0,14,15,17,18,19,20,21,22,23,25,26,27,28],tristate_lexicographical_compar:13,effect:[18,3,20,10],cbegin:16,constexpr:15,base:15,bitset:21,otherwis:[0,22,1,7,8,17,10,25,19,2,5,12],org:15,modifi:[13,16],genyamurakami:15,valu:[14,23,7,8,3,17,10,18,16,19,20,2,11],both:11,search:[13,6,10],last:[22,18,14,1,23,8,9,17,25,4,19,20,26,2,5,11,12,28],upper_bound:13,most:[0,22,14,1,8,3,17,10,25,18,19,20,26,2,27,12,28],equal:[13,0,14,23,7,8,3,17,10,18,19,20,2,11],greater:[22,1,25,28],static_assert:[1,3,4,5,7,8,9,10,11,12,0,14,17,18,19,20,2,22,23,25,26,27,28],is_heap_until:13,range_algorithm:21,ptrdiff_t:16,implement:16,bolero:15,com:15,support:[6,21,15],search_n:[13,20],oper:[13,16],softwar:15,rang:[1,3,5,7,8,9,10,11,12,0,14,17,18,19,20,2,22,23,25,26,27,28],declval:16,point:15,modul:6,genya:15,forwarditer:[4,20,11,5],header:[0,1,3,4,5,7,8,9,10,11,12,13,14,15,16,17,18,19,20,2,22,23,24,25,26,27,28],permut:7,fill:16,empti:[22,1,16,8,3,17,10,25,18,19,2,12],linux:15,max_el:13,instal:[6,15],minmax_el:13,lexicograph:13,inputiter:[22,14,1,23,8,9,17,25,19,26,2,12,28],preprocessor:21,bind2nd:[22,1,9,25,26,12,28],given:[7,0,27],from:[14,23,3,10,18,20,26,11,9,28],would:7,pred:[0,22,1,7,3,10,25,18,20,26,27,11,9,12,28],licens:15,contact:15,capac:16,construct:16,bool:[0,22,1,7,8,17,25,4,16,19,2,12],websit:15,start:15,adjac:11,bolero_murakami:15,includ:[1,3,4,5,7,8,9,10,11,12,0,14,17,18,19,20,2,22,23,25,26,27,28],find_first_of:[13,3],second:27,interfac:[24,1,3,4,5,7,8,9,10,11,12,0,14,16,17,18,19,20,2,22,23,25,26,27,28],conveni:[1,3,4,5,7,8,9,10,11,12,0,14,16,17,18,19,20,2,22,23,25,26,27,28],type:[16,20],until:5,cend:16,swap:[16,24],"function":[24,1,2,3,4,5,7,8,9,10,11,12,0,14,16,17,18,19,20,21,22,23,25,26,27,28],project:[6,15],option:21,comparison:13,namespac:[1,3,4,5,7,8,9,10,11,12,0,14,17,18,19,20,2,22,23,25,26,27,28],tupl:21,copi:[16,15],mismatch:[13,27],metaprogram:21,ani:[18,20,1,17,10],std:[16,24,9,23],link:15,indic:6,sprout_noexcept_expr:[16,24],iterator_trait:[9,23],first1:[0,7,3,10,18,27],first2:[0,7,3,10,18,27],hold:[0,14,23,3,10,18,20,26,27,11,9,28],"true":[0,22,1,7,8,17,25,19,2,12],than:[22,1,10,25,20,26,12,28],count:[13,9,20,23],none:[22,19],input:[22,14,1,23,8,9,17,25,4,19,26,2,5,11,12,28],stl:21,hpp:[0,1,3,4,5,7,8,9,10,16,11,12,13,14,24,17,18,19,20,2,22,23,25,26,27,28],access:[7,0,16],maximum:13,structur:21,const_reverse_iter:16,is_decreas:13,defin:16,sprout_constexpr:[24,1,3,4,5,7,8,9,10,11,12,0,14,16,17,18,19,20,2,22,23,25,26,27,28],minimum:13,below:[7,0,27],store:21,crend:16,posit:[14,3,10,18,20,26,5,27,11,28],meet:[7,0],invoc:[1,3,4,5,7,8,9,10,11,12,0,14,17,18,19,20,2,22,23,25,26,27,28],other:[11,15],arr:24,none_of_equ:[13,19],result:[1,3,4,5,7,8,9,10,11,12,0,14,17,18,19,20,2,22,23,25,26,27,28],input2:[0,7,3,10,18,27],sort:[13,4,5],input1:[0,14,7,3,10,18,20,26,27,28],constant:16,rend:16,individu:15,give:15,"int":[1,3,4,5,7,8,9,10,11,12,0,14,17,18,19,20,2,22,23,25,26,27,28],can:15,argument:[7,0,27],templat:[24,1,2,3,4,5,7,8,9,10,11,12,0,14,16,17,18,19,20,21,22,23,25,26,27,28],rai:[21,15],typedef:16,exist:7,hatena:15,file:15,tabl:6,everi:[0,8,19,22,12],clamp:13,predic:[0,22,14,1,23,7,8,3,17,10,25,18,19,20,26,2,27,11,9,12,28],worst:7,count_if:[13,9],denot:[7,0,27],to_arrai:24,end:[1,3,4,5,7,8,9,10,11,12,0,14,16,17,18,19,20,2,22,23,25,26,27,28],welcom:[6,15],lib:15,author:[6,15],alphabet:21,nonneg:[18,10],depth:[1,3,4,5,7,8,9,10,11,12,0,14,17,18,19,20,2,22,23,25,26,27,28],static_s:16,data:[16,21],member:[16,24],binari:13,complex:[1,3,4,5,7,8,9,10,11,12,0,14,17,18,19,20,2,22,23,25,26,27,28],find_if_not:[13,26],modulu:9,which:[14,23,15,9,26,5,27,11,28],lower_bound:13,difference_typ:[16,9,23],size_t:[16,24],equal_rang:13,"void":[16,24],sprout_noexcept:16,sprout_static_constexpr:[1,3,4,5,7,8,9,10,11,12,0,14,16,17,18,19,20,2,22,23,25,26,27,28],begin:[1,3,4,5,7,8,9,10,11,12,0,14,16,17,18,19,20,2,22,23,25,26,27,28],http:15,distribut:15,trace:[21,15],shall:20,max:13,"class":[16,24,21],object:21,variant:21,gcc:15,size_typ:16,initi:16,max_siz:16,typenam:[24,1,3,4,5,7,8,9,10,11,12,0,14,16,17,18,19,20,2,22,23,25,26,27,28],pair:27,crbegin:16,const_iter:16,one_of:[13,25],heap:13,remark:[7,0,27],exactli:[7,9,11,23],github:15,compar:[4,5],algorithm:[0,1,2,3,4,5,7,8,9,10,11,12,13,14,15,17,18,19,20,21,22,23,25,26,27,28],reverse_iter:16,directori:15,min:[13,0,27,11],descript:[16,15],correspond:[0,14,23,7,3,10,18,20,26,27,11,9,28],assign:16,is_heap:13,exampl:[1,3,4,5,7,8,9,10,11,12,0,14,17,18,19,20,2,22,23,25,26,27,28],thi:15,destroi:16,facebook:15,element:[14,23,7,3,16,26,11,9,28],first:[22,14,1,23,8,3,17,10,25,4,19,20,26,2,5,27,11,9,12,28],convert:20},titles:["equal","any_of","one_of_equal","find_first_of","is_sorted","is_sorted_until","Welcome to Sprout’s documentation!","is_permutation","all_of_equal","count_if","search","adjacent_find","all_of","Sprout.Algorithm","find","Sprout C++ Libraries","Class template array","any_of_equal","find_end","none_of_equal","search_n","Libraries","none_of","count","Sprout.Array","one_of","find_if_not","mismatch","find_if"],modules:{},descrefs:{},filenames:["libs/sprout/algorithm/equal","libs/sprout/algorithm/any_of","libs/sprout/algorithm/one_of_equal","libs/sprout/algorithm/find_first_of","libs/sprout/algorithm/is_sorted","libs/sprout/algorithm/is_sorted_until","index","libs/sprout/algorithm/is_permutation","libs/sprout/algorithm/all_of_equal","libs/sprout/algorithm/count_if","libs/sprout/algorithm/search","libs/sprout/algorithm/adjacent_find","libs/sprout/algorithm/all_of","libs/sprout/algorithm/index","libs/sprout/algorithm/find","libs/index","libs/sprout/array/array/index","libs/sprout/algorithm/any_of_equal","libs/sprout/algorithm/find_end","libs/sprout/algorithm/none_of_equal","libs/sprout/algorithm/search_n","libs/libraries","libs/sprout/algorithm/none_of","libs/sprout/algorithm/count","libs/sprout/array/index","libs/sprout/algorithm/one_of","libs/sprout/algorithm/find_if_not","libs/sprout/algorithm/mismatch","libs/sprout/algorithm/find_if"]}) \ No newline at end of file diff --git a/source/libs/sprout/algorithm/index.rst b/source/libs/sprout/algorithm/index.rst index 93313e17..f6e58c75 100644 --- a/source/libs/sprout/algorithm/index.rst +++ b/source/libs/sprout/algorithm/index.rst @@ -27,6 +27,8 @@ Sprout.Algorithm is_permutation search search_n + is_sorted + is_sorted_until .. _sprout-algorithm-non_modifying: ******************************************************************************* diff --git a/source/libs/sprout/algorithm/is_sorted.rst b/source/libs/sprout/algorithm/is_sorted.rst new file mode 100644 index 00000000..8e58f365 --- /dev/null +++ b/source/libs/sprout/algorithm/is_sorted.rst @@ -0,0 +1,46 @@ +.. _sprout-algorithm-is_sorted: +############################################################################### +is_sorted +############################################################################### + +Interface +======================================== +.. sourcecode:: c++ + + template + inline SPROUT_CONSTEXPR bool + is_sorted(ForwardIterator first, ForwardIterator last); + + template + inline SPROUT_CONSTEXPR bool + is_sorted(ForwardIterator first, ForwardIterator last, Compare comp); + +Returns +======================================== + +| ``is_sorted_until(first, last) == last``, ``is_sorted_until(first, last, comp) == last`` + +Examples +======================================== +.. sourcecode:: c++ + + #include + #include + #include + using namespace sprout; + + SPROUT_STATIC_CONSTEXPR auto input = array{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}; + SPROUT_STATIC_CONSTEXPR auto result = sprout::is_sorted(begin(input), end(input)); + static_assert(result, "input is sorted."); + +Complexity +======================================== + +| Recursive function invocations in *O(logN)* (logarithmic) depth. + +Header +======================================== + +| ``sprout/algorithm/is_sorted.hpp`` +| Convenience header: ``sprout/algorithm.hpp`` + diff --git a/source/libs/sprout/algorithm/is_sorted_until.rst b/source/libs/sprout/algorithm/is_sorted_until.rst new file mode 100644 index 00000000..e3793900 --- /dev/null +++ b/source/libs/sprout/algorithm/is_sorted_until.rst @@ -0,0 +1,48 @@ +.. _sprout-algorithm-is_sorted_until: +############################################################################### +is_sorted_until +############################################################################### + +Interface +======================================== +.. sourcecode:: c++ + + template + inline SPROUT_CONSTEXPR ForwardIterator + is_sorted_until(ForwardIterator first, ForwardIterator last); + + template + inline SPROUT_CONSTEXPR ForwardIterator + is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp); + +Returns +======================================== + +| If ``distance(first, last) < 2``, returns last. +| Otherwise, returns the last iterator i in [first,last] for which the range [first,i) is sorted. + +Examples +======================================== +.. sourcecode:: c++ + + #include + #include + #include + using namespace sprout; + + SPROUT_STATIC_CONSTEXPR auto input = array{{6, 7, 8, 8, 10, 1, 2, 3, 4, 5}}; + SPROUT_STATIC_CONSTEXPR auto result = sprout::is_sorted_until(begin(input), end(input)); + static_assert(result - begin(input) == 5, "input is sorted until position 5."); + +Complexity +======================================== + +| Linear. +| Recursive function invocations in *O(logN)* (logarithmic) depth. + +Header +======================================== + +| ``sprout/algorithm/is_sorted_until.hpp`` +| Convenience header: ``sprout/algorithm.hpp`` +