diff --git a/docs/_sources/libs/sprout/algorithm/adjacent_find.txt b/docs/_sources/libs/sprout/algorithm/adjacent_find.txt new file mode 100644 index 00000000..5cd76848 --- /dev/null +++ b/docs/_sources/libs/sprout/algorithm/adjacent_find.txt @@ -0,0 +1,49 @@ +.. _sprout-algorithm-adjacent_find: +############################################################################### +adjacent_find +############################################################################### + +Interface +======================================== +.. sourcecode:: c++ + + template + inline SPROUT_CONSTEXPR ForwardIterator + adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred); + + template + inline SPROUT_CONSTEXPR ForwardIterator + adjacent_find(ForwardIterator first, ForwardIterator last); + +Returns +======================================== + +| The first iterator i such that both i and i + 1 are in the range [first,last) for which the following corresponding conditions hold: ``*i == *(i + 1)``, ``pred(*i, *(i + 1))``. +| Returns last if no such iterator is found. + +Examples +======================================== +.. sourcecode:: c++ + + #include + #include + #include + using namespace sprout; + + SPROUT_STATIC_CONSTEXPR auto input = array{{1, 2, 3, 5, 5, 6, 6, 8, 9, 10}}; + SPROUT_STATIC_CONSTEXPR auto result = sprout::adjacent_find(begin(input), end(input)); + static_assert(result != end(input), "found adjacent elements equal to each other from input."); + static_assert(result - begin(input) == 3, "a found position is 3."); + +Complexity +======================================== + +| For a nonempty range, exactly ``min((i - first) + 1, (last - first) - 1)`` applications of the corresponding predicate, where i is adjacent_findfs return value. +| Recursive function invocations in *O(logN)* (logarithmic) depth. + +Header +======================================== + +| ``sprout/algorithm/adjacent_find.hpp`` +| Convenience header: ``sprout/algorithm.hpp`` + diff --git a/docs/_sources/libs/sprout/algorithm/find.txt b/docs/_sources/libs/sprout/algorithm/find.txt index 252f8d1c..714c7325 100644 --- a/docs/_sources/libs/sprout/algorithm/find.txt +++ b/docs/_sources/libs/sprout/algorithm/find.txt @@ -29,7 +29,7 @@ Examples SPROUT_STATIC_CONSTEXPR auto input = array{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}; SPROUT_STATIC_CONSTEXPR auto result = sprout::find(begin(input), end(input), 8); static_assert(result != end(input), "found a element equal to 8 from input."); - static_assert(*result == 8, "a found iterator is pointing to 8."); + static_assert(result - begin(input1) == 7, "a found position is 7."); Complexity ======================================== diff --git a/docs/_sources/libs/sprout/algorithm/find_end.txt b/docs/_sources/libs/sprout/algorithm/find_end.txt new file mode 100644 index 00000000..63a8befa --- /dev/null +++ b/docs/_sources/libs/sprout/algorithm/find_end.txt @@ -0,0 +1,62 @@ +.. _sprout-algorithm-find: +############################################################################### +find_end +############################################################################### + +Interface +======================================== +.. sourcecode:: c++ + + template + inline SPROUT_CONSTEXPR ForwardIterator1 + find_end( + ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2 + ); + + template + inline SPROUT_CONSTEXPR ForwardIterator1 + find_end( + ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2, + BinaryPredicate pred + ); + +Effects +======================================== + +| Finds a subsequence of equal values in a sequence. + +Returns +======================================== + +| The last iterator i in the range [first1,last1 - (last2 - first2)) such that for any nonnegative integer ``n < (last2 - first2)``, the following corresponding conditions hold: ``*(i + n) == *(first2 + n)``, ``pred(*(i + n), *(first2 + n))``. +| Returns last1 if [first2,last2) is empty or if no such iterator is found. + +Examples +======================================== +.. sourcecode:: c++ + + #include + #include + #include + using namespace sprout; + + SPROUT_STATIC_CONSTEXPR auto input1 = array{{1, 2, 3, 4, 5, 1, 2, 3, 4, 5}}; + SPROUT_STATIC_CONSTEXPR auto input2 = array{{3, 4, 5}}; + SPROUT_STATIC_CONSTEXPR auto result = sprout::find_end(begin(input1), end(input1), begin(input2), end(input2)); + static_assert(result != end(input1), "found a subsequence equal to input2 from input1."); + static_assert(result - begin(input1) == 7, "a found position is 7."); + +Complexity +======================================== + +| At most ``(last2 - first2) * (last1 - first1 - (last2 - first2) + 1)`` applications of the corresponding predicate. +| Recursive function invocations in *O(logN)* (logarithmic) depth. + +Header +======================================== + +| ``sprout/algorithm/find_end.hpp`` +| Convenience header: ``sprout/algorithm.hpp`` + diff --git a/docs/_sources/libs/sprout/algorithm/find_first_of.txt b/docs/_sources/libs/sprout/algorithm/find_first_of.txt new file mode 100644 index 00000000..c5aa5b58 --- /dev/null +++ b/docs/_sources/libs/sprout/algorithm/find_first_of.txt @@ -0,0 +1,62 @@ +.. _sprout-algorithm-find: +############################################################################### +find_first_of +############################################################################### + +Interface +======================================== +.. sourcecode:: c++ + + template + inline SPROUT_CONSTEXPR InputIterator1 + find_first_of( + InputIterator1 first1, InputIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2 + ); + + template + inline SPROUT_CONSTEXPR InputIterator1 + find_first_of( + InputIterator1 first1, InputIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2, + BinaryPredicate pred + ); + +Effects +======================================== + +| Finds an element that matches one of a set of values. + +Returns +======================================== + +| The first iterator i in the range [first1,last1) such that for some iterator j in the range [first2,last2) the following conditions hold: ``*i == *j``, ``pred(*i,*j)``. +| Returns last1 if [first2,last2) is empty or if no such iterator is found. + +Examples +======================================== +.. sourcecode:: c++ + + #include + #include + #include + using namespace sprout; + + SPROUT_STATIC_CONSTEXPR auto input1 = array{{1, 2, 3, 4, 5, 1, 2, 3, 4, 5}}; + SPROUT_STATIC_CONSTEXPR auto input2 = array{{3, 4, 5}}; + SPROUT_STATIC_CONSTEXPR auto result = sprout::find_first_of(begin(input1), end(input1), begin(input2), end(input2)); + static_assert(result != end(input1), "found an element equal to an one of input2 from input1."); + static_assert(result - begin(input1) == 2, "a found position is 2."); + +Complexity +======================================== + +| At most ``(last2 - first2) * (last1 - first1 - (last2 - first2) + 1)`` applications of the corresponding predicate. +| Recursive function invocations in *O(logN)* (logarithmic) depth. + +Header +======================================== + +| ``sprout/algorithm/find_first_of.hpp`` +| Convenience header: ``sprout/algorithm.hpp`` + diff --git a/docs/_sources/libs/sprout/algorithm/find_if.txt b/docs/_sources/libs/sprout/algorithm/find_if.txt index 4196b82f..e2ddd33f 100644 --- a/docs/_sources/libs/sprout/algorithm/find_if.txt +++ b/docs/_sources/libs/sprout/algorithm/find_if.txt @@ -30,7 +30,7 @@ Examples SPROUT_STATIC_CONSTEXPR auto input = array{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}; SPROUT_STATIC_CONSTEXPR auto result = sprout::find_if(begin(input), end(input), bind2nd(greater<>(), 7)); static_assert(result != end(input), "found a element greater than 7 from input."); - static_assert(*result == 8, "a found iterator is pointing to 8."); + static_assert(result - begin(input1) == 7, "a found position is 7."); Complexity ======================================== diff --git a/docs/_sources/libs/sprout/algorithm/find_if_not.txt b/docs/_sources/libs/sprout/algorithm/find_if_not.txt index c8797651..7239e987 100644 --- a/docs/_sources/libs/sprout/algorithm/find_if_not.txt +++ b/docs/_sources/libs/sprout/algorithm/find_if_not.txt @@ -30,7 +30,7 @@ Examples SPROUT_STATIC_CONSTEXPR auto input = array{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}; SPROUT_STATIC_CONSTEXPR auto result = sprout::find_if_not(begin(input), end(input), bind2nd(less<>(), 8)); static_assert(result != end(input), "found a element not less than 8 from input."); - static_assert(*result == 8, "a found iterator is pointing to 8."); + static_assert(result - begin(input1) == 7, "a found position is 7."); Complexity ======================================== diff --git a/docs/_sources/libs/sprout/algorithm/index.txt b/docs/_sources/libs/sprout/algorithm/index.txt index d49cf31e..5a543eed 100644 --- a/docs/_sources/libs/sprout/algorithm/index.txt +++ b/docs/_sources/libs/sprout/algorithm/index.txt @@ -17,6 +17,9 @@ Sprout.Algorithm find find_if find_if_not + find_end + find_first_of + adjacent_find .. _sprout-algorithm-non_modifying: ******************************************************************************* diff --git a/docs/libs/sprout/algorithm/adjacent_find.html b/docs/libs/sprout/algorithm/adjacent_find.html new file mode 100644 index 00000000..18fd36e6 --- /dev/null +++ b/docs/libs/sprout/algorithm/adjacent_find.html @@ -0,0 +1,162 @@ + + + + + + + adjacent_find — Sprout v1.0 documentation + + + + + + + + + + + + +
+
+
+
+ +
+

adjacent_find

+
+

Interface

+
template<typename ForwardIterator, typename BinaryPredicate>
+inline SPROUT_CONSTEXPR ForwardIterator
+adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
+
+template<typename ForwardIterator>
+inline SPROUT_CONSTEXPR ForwardIterator
+adjacent_find(ForwardIterator first, ForwardIterator last);
+
+
+
+
+

Returns

+
+
The first iterator i such that both i and i + 1 are in the range [first,last) for which the following corresponding conditions hold: *i == *(i + 1), pred(*i, *(i + 1)).
+
Returns last if no such iterator is found.
+
+
+
+

Examples

+
#include <sprout/algorithm/adjacent_find.hpp>
+#include <sprout/array.hpp>
+#include <sprout/container.hpp>
+using namespace sprout;
+
+SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 2, 3, 5, 5, 6, 6, 8, 9, 10}};
+SPROUT_STATIC_CONSTEXPR auto result = sprout::adjacent_find(begin(input), end(input));
+static_assert(result != end(input), "found adjacent elements equal to each other from input.");
+static_assert(result - begin(input) == 3, "a found position is 3.");
+
+
+
+
+

Complexity

+
+
For a nonempty range, exactly min((i - first) + 1, (last - first) - 1) applications of the corresponding predicate, where i is adjacent_find?fs return value.
+
Recursive function invocations in O(logN) (logarithmic) depth.
+
+
+ +
+ + +
+
+
+
+
+

Table Of Contents

+ + +

Previous topic

+

find_first_of

+

This Page

+ + + +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/libs/sprout/algorithm/find.html b/docs/libs/sprout/algorithm/find.html index d63bc39b..9f846606 100644 --- a/docs/libs/sprout/algorithm/find.html +++ b/docs/libs/sprout/algorithm/find.html @@ -76,7 +76,7 @@ SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}; SPROUT_STATIC_CONSTEXPR auto result = sprout::find(begin(input), end(input), 8); static_assert(result != end(input), "found a element equal to 8 from input."); -static_assert(*result == 8, "a found iterator is pointing to 8."); +static_assert(result - begin(input1) == 7, "a found position is 7."); diff --git a/docs/libs/sprout/algorithm/find_end.html b/docs/libs/sprout/algorithm/find_end.html new file mode 100644 index 00000000..595ee9aa --- /dev/null +++ b/docs/libs/sprout/algorithm/find_end.html @@ -0,0 +1,187 @@ + + + + + + + find_end — Sprout v1.0 documentation + + + + + + + + + + + + + +
+
+
+
+ +
+

find_end

+
+

Interface

+
template<typename ForwardIterator1, typename ForwardIterator2>
+inline SPROUT_CONSTEXPR ForwardIterator1
+find_end(
+      ForwardIterator1 first1, ForwardIterator1 last1,
+      ForwardIterator2 first2, ForwardIterator2 last2
+      );
+
+template<typename ForwardIterator1, typename ForwardIterator2, typename BinaryPredicate>
+inline SPROUT_CONSTEXPR ForwardIterator1
+find_end(
+      ForwardIterator1 first1, ForwardIterator1 last1,
+      ForwardIterator2 first2, ForwardIterator2 last2,
+      BinaryPredicate pred
+      );
+
+
+
+
+

Effects

+
+
Finds a subsequence of equal values in a sequence.
+
+
+
+

Returns

+
+
The last iterator i in the range [first1,last1 - (last2 - first2)) such that for any nonnegative integer n < (last2 - first2), the following corresponding conditions hold: *(i + n) == *(first2 + n), pred(*(i + n), *(first2 + n)).
+
Returns last1 if [first2,last2) is empty or if no such iterator is found.
+
+
+
+

Examples

+
#include <sprout/algorithm/find_end.hpp>
+#include <sprout/array.hpp>
+#include <sprout/container.hpp>
+using namespace sprout;
+
+SPROUT_STATIC_CONSTEXPR auto input1 = array<int, 10>{{1, 2, 3, 4, 5, 1, 2, 3, 4, 5}};
+SPROUT_STATIC_CONSTEXPR auto input2 = array<int, 3>{{3, 4, 5}};
+SPROUT_STATIC_CONSTEXPR auto result = sprout::find_end(begin(input1), end(input1), begin(input2), end(input2));
+static_assert(result != end(input1), "found a subsequence equal to input2 from input1.");
+static_assert(result - begin(input1) == 7, "a found position is 7.");
+
+
+
+
+

Complexity

+
+
At most (last2 - first2) * (last1 - first1 - (last2 - first2) + 1) applications of the corresponding predicate.
+
Recursive function invocations in O(logN) (logarithmic) depth.
+
+
+ +
+ + +
+
+
+
+
+

Table Of Contents

+ + +

Previous topic

+

find_if_not

+

Next topic

+

find_first_of

+

This Page

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

find_first_of

+
+

Interface

+
template<typename InputIterator1, typename ForwardIterator2>
+inline SPROUT_CONSTEXPR InputIterator1
+find_first_of(
+      InputIterator1 first1, InputIterator1 last1,
+      ForwardIterator2 first2, ForwardIterator2 last2
+      );
+
+template<typename InputIterator1, typename ForwardIterator2, typename BinaryPredicate>
+inline SPROUT_CONSTEXPR InputIterator1
+find_first_of(
+      InputIterator1 first1, InputIterator1 last1,
+      ForwardIterator2 first2, ForwardIterator2 last2,
+      BinaryPredicate pred
+      );
+
+
+
+
+

Effects

+
+
Finds an element that matches one of a set of values.
+
+
+
+

Returns

+
+
The first iterator i in the range [first1,last1) such that for some iterator j in the range [first2,last2) the following conditions hold: *i == *j, pred(*i,*j).
+
Returns last1 if [first2,last2) is empty or if no such iterator is found.
+
+
+
+

Examples

+
#include <sprout/algorithm/find_first_of.hpp>
+#include <sprout/array.hpp>
+#include <sprout/container.hpp>
+using namespace sprout;
+
+SPROUT_STATIC_CONSTEXPR auto input1 = array<int, 10>{{1, 2, 3, 4, 5, 1, 2, 3, 4, 5}};
+SPROUT_STATIC_CONSTEXPR auto input2 = array<int, 3>{{3, 4, 5}};
+SPROUT_STATIC_CONSTEXPR auto result = sprout::find_first_of(begin(input1), end(input1), begin(input2), end(input2));
+static_assert(result != end(input1), "found an element equal to an one of input2 from input1.");
+static_assert(result - begin(input1) == 2, "a found position is 2.");
+
+
+
+
+

Complexity

+
+
At most (last2 - first2) * (last1 - first1 - (last2 - first2) + 1) applications of the corresponding predicate.
+
Recursive function invocations in O(logN) (logarithmic) depth.
+
+
+ +
+ + +
+
+
+
+
+

Table Of Contents

+ + +

Previous topic

+

find_end

+

Next topic

+

adjacent_find

+

This Page

+ + + +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/libs/sprout/algorithm/find_if.html b/docs/libs/sprout/algorithm/find_if.html index ddaabf0b..74619a8c 100644 --- a/docs/libs/sprout/algorithm/find_if.html +++ b/docs/libs/sprout/algorithm/find_if.html @@ -77,7 +77,7 @@ SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}; SPROUT_STATIC_CONSTEXPR auto result = sprout::find_if(begin(input), end(input), bind2nd(greater<>(), 7)); static_assert(result != end(input), "found a element greater than 7 from input."); -static_assert(*result == 8, "a found iterator is pointing to 8."); +static_assert(result - begin(input1) == 7, "a found position is 7."); diff --git a/docs/libs/sprout/algorithm/find_if_not.html b/docs/libs/sprout/algorithm/find_if_not.html index 48229a29..6c5229d8 100644 --- a/docs/libs/sprout/algorithm/find_if_not.html +++ b/docs/libs/sprout/algorithm/find_if_not.html @@ -21,6 +21,7 @@ + @@ -30,6 +31,9 @@
  • index
  • +
  • + next |
  • previous |
  • @@ -73,7 +77,7 @@ SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}; SPROUT_STATIC_CONSTEXPR auto result = sprout::find_if_not(begin(input), end(input), bind2nd(less<>(), 8)); static_assert(result != end(input), "found a element not less than 8 from input."); -static_assert(*result == 8, "a found iterator is pointing to 8."); +static_assert(result - begin(input1) == 7, "a found position is 7."); @@ -114,6 +118,9 @@

    Previous topic

    find_if

    +

    Next topic

    +

    find_end

    This Page

    • index
    • +
    • + next |
    • previous |
    • diff --git a/docs/libs/sprout/algorithm/index.html b/docs/libs/sprout/algorithm/index.html index 2f0522dd..14d5a1c0 100644 --- a/docs/libs/sprout/algorithm/index.html +++ b/docs/libs/sprout/algorithm/index.html @@ -64,9 +64,9 @@
    • find
    • find_if
    • find_if_not
    • -
    • find_end
    • -
    • find_first_of
    • -
    • adjacent_find
    • +
    • find_end
    • +
    • find_first_of
    • +
    • adjacent_find
    • count
    • count_if
    • mismatch
    • diff --git a/docs/searchindex.js b/docs/searchindex.js index 5c9557b4..a2c2c9cb 100644 --- a/docs/searchindex.js +++ b/docs/searchindex.js @@ -1 +1 @@ -Search.setIndex({desctypes:{},terms:{logarithm:[4,2,3,7,9,10,11,12,14,15,16],any_of:[0,3],all:[7,15],c_arrai:6,less:[12,15],sprout:[0,1,2,3,4,5,6,7,8,9,10,11,12,14,15,16],random:5,rbegin:6,all_of:[0,15],through:5,minmax:0,follow:[2,12,16],pointer:6,find:[0,2],find_if:[0,16],is_strictly_increas:0,content:1,onli:[6,10,14,5],inlin:[4,8,2,3,7,9,10,11,12,14,15,16],"const":[8,2,6,7,9,11,14],miscellan:13,copyright:[1,5],is_sort:0,fix:13,binary_search:0,blog:5,version:5,swap:[6,8],under:5,mail:5,is_strictly_decreas:0,arrai:[4,8,2,3,14,6,7,9,10,11,12,13,15,16],first:[4,2,3,7,9,10,11,12,14,15,16],applic:[4,2,3,7,9,10,11,12,14,15,16],non:[0,8],license_1_0:5,"return":[4,2,3,7,9,10,11,12,14,15,16],count_if:0,murakami:5,fals:[4,3,7,9,10,11,14,15],auto:[4,2,3,7,9,10,11,12,14,15,16],is_sorted_until:0,clang:5,number:5,range_adaptor:13,is_increas:0,front:6,none_of:[0,4],recurs:[4,2,3,7,9,10,11,12,14,15,16],min_el:0,lexicographical_compar:0,document:[1,5],like:13,specif:13,one_of_equ:[0,14],list:13,synthes:[13,5],iter:[4,2,3,14,6,7,9,10,11,12,13,15,16],const_refer:6,stl:13,mode:5,each:5,pars:[13,5],found:[2,12,16],path:5,page:[1,5],compil:[1,5],adjacent_find:0,domain:13,find_end:0,twitter:5,is_permut:0,back:6,predic:[4,2,3,7,9,10,11,12,14,15,16],size_t:[6,8],see:5,result:[4,2,3,7,9,10,11,12,14,15,16],none_of_equ:[0,11],logn:[4,2,3,7,9,10,11,12,14,15,16],any_of_equ:[0,9],correspond:[2,12,16],librari:[1,13,5],compat:13,index:1,txt:5,slideshar:5,brief:5,all_of_equ:[0,7],categori:13,mathemat:13,const_point:6,sequenc:[0,13],accompani:5,condit:[2,12,16],net:5,size:[6,13],boost:5,refer:6,next_permut:0,value_typ:6,numer:13,gener:[0,13],contain:[4,2,3,14,5,7,9,10,11,12,13,15,16],tristate_lexicographical_compar:0,cbegin:6,constexpr:5,base:5,bitset:13,org:5,modifi:[0,6],genyamurakami:5,valu:[2,6,7,9,11,14],comparison:0,search:[0,1],last:[4,2,3,7,9,10,11,12,14,15,16],arr:8,most:[4,2,3,7,9,10,11,12,14,15,16],equal:[0,2,7,9,11,14],greater:[4,3,10,16],static_assert:[4,2,3,7,9,10,11,12,14,15,16],is_heap_until:0,range_algorithm:13,ptrdiff_t:6,one_of:[0,10],com:5,support:[1,13,5],preprocessor:13,oper:[0,6],softwar:5,rang:[4,2,3,7,9,10,11,12,14,15,16],declval:6,point:[2,16,12,5],modul:1,genya:5,header:[0,4,2,3,5,6,7,8,9,10,11,12,14,15,16],permut:0,fill:6,empti:[4,3,6,7,9,10,11,14,15],linux:5,max_el:0,instal:[1,5],minmax_el:0,lexicograph:0,inputiter:[4,2,3,7,9,10,11,12,14,15,16],range_numer:13,bind2nd:[4,3,10,12,15,16],from:[2,12,16],pred:[4,3,10,12,15,16],licens:5,contact:5,capac:6,construct:6,bool:[4,3,6,7,9,10,11,14,15],websit:5,start:5,compliant:13,bolero_murakami:5,includ:[4,2,3,7,9,10,11,12,14,15,16],find_first_of:0,interfac:[4,8,2,3,6,7,9,10,11,12,14,15,16],conveni:[4,2,3,6,7,9,10,11,12,14,15,16],type:6,individu:5,cend:6,"function":[4,8,2,3,14,6,7,9,10,11,12,13,15,16],project:[1,5],option:13,namespac:[4,2,3,7,9,10,11,12,14,15,16],tupl:13,copi:[6,5],mismatch:0,metaprogram:13,std:[6,8],link:5,indic:1,sprout_noexcept_expr:[6,8],input:[4,2,3,7,9,10,11,12,14,15,16],hold:[2,12,16],"true":[4,3,7,9,10,11,14,15],than:[4,3,10,12,15,16],count:0,none:[4,11],upper_bound:0,prev_permut:0,access:6,maximum:0,structur:13,const_reverse_iter:6,is_decreas:0,defin:6,sprout_constexpr:[4,8,2,3,6,7,9,10,11,12,14,15,16],minimum:0,store:13,www:5,crend:6,otherwis:[4,3,7,9,10,11,14,15],invoc:[4,2,3,7,9,10,11,12,14,15,16],other:5,bolero:5,sort:0,constant:6,rend:6,give:5,"int":[4,2,3,7,9,10,11,12,14,15,16],can:5,ani:[3,9],templat:[4,8,2,3,14,6,7,9,10,11,12,13,15,16],rai:[13,5],typedef:6,hatena:5,file:5,tabl:1,everi:[4,7,11,15],clamp:0,element:[6,2,12,16],exposit:6,string:13,to_arrai:8,end:[4,2,3,6,7,9,10,11,12,14,15,16],welcom:[1,5],lib:5,author:[1,5],alphabet:13,hpp:[0,4,2,3,6,7,8,9,10,11,12,14,15,16],depth:[4,2,3,7,9,10,11,12,14,15,16],static_s:6,data:[6,13],member:[6,8],binari:0,complex:[4,2,3,7,9,10,11,12,14,15,16],find_if_not:[0,12],which:[2,16,12,5],lower_bound:0,difference_typ:6,equal_rang:0,"void":[6,8],sprout_noexcept:6,begin:[4,2,3,6,7,9,10,11,12,14,15,16],http:5,distribut:5,trace:[13,5],max:0,"class":[6,8,13],object:13,variant:13,gcc:5,size_typ:6,initi:6,max_siz:6,typenam:[4,8,2,3,6,7,9,10,11,12,14,15,16],crbegin:6,const_iter:6,implement:6,heap:0,github:5,algorithm:[0,4,2,3,14,5,7,9,10,11,12,13,15,16],reverse_iter:6,directori:5,min:0,descript:[6,5],elem:6,assign:6,is_heap:0,exampl:[4,2,3,7,9,10,11,12,14,15,16],thi:5,destroi:6,facebook:5,sprout_static_constexpr:[4,2,3,6,7,9,10,11,12,14,15,16],search_n:0},titles:["Sprout.Algorithm","Welcome to Sprout’s documentation!","find","any_of","none_of","Sprout C++ Libraries","Class template array","all_of_equal","Sprout.Array","any_of_equal","one_of","none_of_equal","find_if_not","Libraries","one_of_equal","all_of","find_if"],modules:{},descrefs:{},filenames:["libs/sprout/algorithm/index","index","libs/sprout/algorithm/find","libs/sprout/algorithm/any_of","libs/sprout/algorithm/none_of","libs/index","libs/sprout/array/array/index","libs/sprout/algorithm/all_of_equal","libs/sprout/array/index","libs/sprout/algorithm/any_of_equal","libs/sprout/algorithm/one_of","libs/sprout/algorithm/none_of_equal","libs/sprout/algorithm/find_if_not","libs/libraries","libs/sprout/algorithm/one_of_equal","libs/sprout/algorithm/all_of","libs/sprout/algorithm/find_if"]}) \ No newline at end of file +Search.setIndex({desctypes:{},terms:{logarithm:[4,2,3,7,8,10,11,12,13,14,16,17,18,19],any_of:[0,3],all:[7,18],hpp:[0,4,2,3,6,7,8,9,10,11,12,13,14,16,17,18,19],set:8,c_arrai:6,less:[14,18],sprout:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,16,17,18,19],random:5,rbegin:6,all_of:[0,18],accompani:5,through:5,binarypred:[12,8,17],follow:[2,8,12,14,17,19],pointer:6,find:[0,12,2,8],find_if:[0,19],is_strictly_increas:0,content:1,onli:[6,11,16,5],inlin:[4,9,2,3,7,8,10,11,12,13,14,16,17,18,19],"const":[9,2,6,7,10,13,16],miscellan:15,copyright:[1,5],is_sort:0,fix:15,binary_search:0,blog:5,version:5,swap:[6,9],under:5,mail:5,subsequ:12,is_strictly_decreas:0,arrai:[4,9,2,3,16,6,7,8,10,11,12,13,14,15,17,18,19],match:8,first:[4,2,3,7,8,10,11,13,14,16,17,18,19],applic:[4,2,3,7,8,10,11,12,13,14,16,17,18,19],non:[0,9],license_1_0:5,"return":[4,2,3,7,8,10,11,12,13,14,16,17,18,19],count_if:0,murakami:5,fals:[4,3,7,10,11,13,16,18],auto:[4,2,3,7,8,10,11,12,13,14,16,17,18,19],is_sorted_until:0,clang:5,number:5,range_adaptor:15,is_increas:0,front:6,none_of:[0,4],compliant:15,recurs:[4,2,3,7,8,10,11,12,13,14,16,17,18,19],min_el:0,lexicographical_compar:0,document:[1,5],like:15,specif:15,one_of_equ:[0,16],list:15,synthes:[15,5],iter:[4,2,3,16,6,7,8,10,11,12,13,14,15,17,18,19],const_refer:6,stl:15,mode:5,each:[17,5],pars:[15,5],found:[2,8,12,14,17,19],path:5,where:17,page:[1,5],compil:[1,5],adjacent_find:[0,17],www:5,find_end:[0,12],twitter:5,is_permut:0,some:8,back:6,minmax:0,see:5,last1:[12,8],integ:12,domain:15,last2:[12,8],logn:[4,2,3,7,8,10,11,12,13,14,16,17,18,19],any_of_equ:[0,10],correspond:[2,8,12,14,17,19],librari:[1,15,5],compat:15,index:1,txt:5,slideshar:5,brief:5,all_of_equ:[0,7],categori:15,inputiterator1:8,mathemat:15,const_point:6,sequenc:[0,12,15],nonempti:17,condit:[2,8,12,14,17,19],net:5,size:[6,15],boost:5,refer:6,next_permut:0,value_typ:6,forwarditerator2:[12,8],forwarditerator1:12,numer:15,gener:[0,15],contain:[4,2,3,16,5,7,8,10,11,12,13,14,15,17,18,19],tristate_lexicographical_compar:0,effect:[12,8],cbegin:6,constexpr:5,base:5,bitset:15,element:[2,6,8,14,17,19],org:5,modifi:[0,6],genyamurakami:5,valu:[2,6,7,8,10,12,13,16,17],both:17,search:[0,1],last:[4,2,3,7,10,11,12,13,14,16,17,18,19],upper_bound:0,most:[4,2,3,7,8,10,11,12,13,14,16,18,19],equal:[0,2,7,8,10,12,13,16,17],greater:[4,3,11,19],static_assert:[4,2,3,7,8,10,11,12,13,14,16,17,18,19],is_heap_until:0,range_algorithm:15,ptrdiff_t:6,one_of:[0,11],bolero:5,com:5,support:[1,15,5],preprocessor:15,oper:[0,6],softwar:5,rang:[4,2,3,7,8,10,11,12,13,14,16,17,18,19],declval:6,point:5,modul:1,genya:5,forwarditer:17,header:[0,4,2,3,5,6,7,8,9,10,11,12,13,14,16,17,18,19],permut:0,fill:6,empti:[4,3,6,7,8,10,11,12,13,16,18],linux:5,max_el:0,instal:[1,5],minmax_el:0,lexicograph:0,inputiter:[4,2,3,7,10,11,13,14,16,18,19],range_numer:15,bind2nd:[4,3,11,14,18,19],from:[2,8,12,14,17,19],pred:[4,3,8,11,12,14,17,18,19],licens:5,contact:5,capac:6,construct:6,bool:[4,3,6,7,10,11,13,16,18],websit:5,start:5,adjac:17,bolero_murakami:5,includ:[4,2,3,7,8,10,11,12,13,14,16,17,18,19],find_first_of:[0,8],interfac:[4,9,2,3,6,7,8,10,11,12,13,14,16,17,18,19],conveni:[4,2,3,6,7,8,10,11,12,13,14,16,17,18,19],type:6,individu:5,cend:6,"function":[4,9,2,3,16,6,7,8,10,11,12,13,14,15,17,18,19],project:[1,5],option:15,comparison:0,namespac:[4,2,3,7,8,10,11,12,13,14,16,17,18,19],tupl:15,copi:[6,5],mismatch:0,metaprogram:15,std:[6,9],link:5,indic:1,sprout_noexcept_expr:[6,9],input:[4,2,3,7,10,11,13,14,16,17,18,19],first1:[12,8],first2:[12,8],hold:[2,8,12,14,17,19],"true":[4,3,7,10,11,13,16,18],than:[4,3,11,14,18,19],count:0,none:[4,13],prev_permut:0,access:6,maximum:0,structur:15,const_reverse_iter:6,is_decreas:0,defin:6,sprout_constexpr:[4,9,2,3,6,7,8,10,11,12,13,14,16,17,18,19],minimum:0,store:15,crend:6,posit:[2,8,12,14,17,19],otherwis:[4,3,7,10,11,13,16,18],invoc:[4,2,3,7,8,10,11,12,13,14,16,17,18,19],other:[17,5],arr:9,none_of_equ:[0,13],result:[4,2,3,7,8,10,11,12,13,14,16,17,18,19],input2:[12,8],sort:0,input1:[12,2,19,8,14],constant:6,rend:6,give:5,"int":[4,2,3,7,8,10,11,12,13,14,16,17,18,19],can:5,ani:[12,3,10],templat:[4,9,2,3,16,6,7,8,10,11,12,13,14,15,17,18,19],rai:[15,5],typedef:6,hatena:5,file:5,tabl:1,everi:[4,7,13,18],clamp:0,predic:[4,2,3,7,8,10,11,12,13,14,16,17,18,19],exposit:6,string:15,to_arrai:9,end:[4,2,3,6,7,8,10,11,12,13,14,16,17,18,19],welcom:[1,5],lib:5,author:[1,5],alphabet:15,nonneg:12,depth:[4,2,3,7,8,10,11,12,13,14,16,17,18,19],static_s:6,data:[6,15],member:[6,9],binari:0,complex:[4,2,3,7,8,10,11,12,13,14,16,17,18,19],find_if_not:[0,14],which:[2,19,17,14,5],lower_bound:0,difference_typ:6,size_t:[6,9],equal_rang:0,"void":[6,9],sprout_noexcept:6,begin:[4,2,3,6,7,8,10,11,12,13,14,16,17,18,19],http:5,distribut:5,trace:[15,5],max:0,"class":[6,9,15],object:15,variant:15,gcc:5,size_typ:6,initi:6,max_siz:6,typenam:[4,9,2,3,6,7,8,10,11,12,13,14,16,17,18,19],crbegin:6,const_iter:6,implement:6,heap:0,exactli:17,github:5,algorithm:[0,4,2,3,16,5,7,8,10,11,12,13,14,15,17,18,19],reverse_iter:6,directori:5,min:[0,17],descript:[6,5],elem:6,assign:6,is_heap:0,exampl:[4,2,3,7,8,10,11,12,13,14,16,17,18,19],thi:5,destroi:6,facebook:5,sprout_static_constexpr:[4,2,3,6,7,8,10,11,12,13,14,16,17,18,19],search_n:0},titles:["Sprout.Algorithm","Welcome to Sprout’s documentation!","find","any_of","none_of","Sprout C++ Libraries","Class template array","all_of_equal","find_first_of","Sprout.Array","any_of_equal","one_of","find_end","none_of_equal","find_if_not","Libraries","one_of_equal","adjacent_find","all_of","find_if"],modules:{},descrefs:{},filenames:["libs/sprout/algorithm/index","index","libs/sprout/algorithm/find","libs/sprout/algorithm/any_of","libs/sprout/algorithm/none_of","libs/index","libs/sprout/array/array/index","libs/sprout/algorithm/all_of_equal","libs/sprout/algorithm/find_first_of","libs/sprout/array/index","libs/sprout/algorithm/any_of_equal","libs/sprout/algorithm/one_of","libs/sprout/algorithm/find_end","libs/sprout/algorithm/none_of_equal","libs/sprout/algorithm/find_if_not","libs/libraries","libs/sprout/algorithm/one_of_equal","libs/sprout/algorithm/adjacent_find","libs/sprout/algorithm/all_of","libs/sprout/algorithm/find_if"]}) \ No newline at end of file diff --git a/source/libs/sprout/algorithm/adjacent_find.rst b/source/libs/sprout/algorithm/adjacent_find.rst new file mode 100644 index 00000000..5cd76848 --- /dev/null +++ b/source/libs/sprout/algorithm/adjacent_find.rst @@ -0,0 +1,49 @@ +.. _sprout-algorithm-adjacent_find: +############################################################################### +adjacent_find +############################################################################### + +Interface +======================================== +.. sourcecode:: c++ + + template + inline SPROUT_CONSTEXPR ForwardIterator + adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred); + + template + inline SPROUT_CONSTEXPR ForwardIterator + adjacent_find(ForwardIterator first, ForwardIterator last); + +Returns +======================================== + +| The first iterator i such that both i and i + 1 are in the range [first,last) for which the following corresponding conditions hold: ``*i == *(i + 1)``, ``pred(*i, *(i + 1))``. +| Returns last if no such iterator is found. + +Examples +======================================== +.. sourcecode:: c++ + + #include + #include + #include + using namespace sprout; + + SPROUT_STATIC_CONSTEXPR auto input = array{{1, 2, 3, 5, 5, 6, 6, 8, 9, 10}}; + SPROUT_STATIC_CONSTEXPR auto result = sprout::adjacent_find(begin(input), end(input)); + static_assert(result != end(input), "found adjacent elements equal to each other from input."); + static_assert(result - begin(input) == 3, "a found position is 3."); + +Complexity +======================================== + +| For a nonempty range, exactly ``min((i - first) + 1, (last - first) - 1)`` applications of the corresponding predicate, where i is adjacent_findfs return value. +| Recursive function invocations in *O(logN)* (logarithmic) depth. + +Header +======================================== + +| ``sprout/algorithm/adjacent_find.hpp`` +| Convenience header: ``sprout/algorithm.hpp`` + diff --git a/source/libs/sprout/algorithm/find.rst b/source/libs/sprout/algorithm/find.rst index 252f8d1c..714c7325 100644 --- a/source/libs/sprout/algorithm/find.rst +++ b/source/libs/sprout/algorithm/find.rst @@ -29,7 +29,7 @@ Examples SPROUT_STATIC_CONSTEXPR auto input = array{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}; SPROUT_STATIC_CONSTEXPR auto result = sprout::find(begin(input), end(input), 8); static_assert(result != end(input), "found a element equal to 8 from input."); - static_assert(*result == 8, "a found iterator is pointing to 8."); + static_assert(result - begin(input1) == 7, "a found position is 7."); Complexity ======================================== diff --git a/source/libs/sprout/algorithm/find_end.rst b/source/libs/sprout/algorithm/find_end.rst new file mode 100644 index 00000000..63a8befa --- /dev/null +++ b/source/libs/sprout/algorithm/find_end.rst @@ -0,0 +1,62 @@ +.. _sprout-algorithm-find: +############################################################################### +find_end +############################################################################### + +Interface +======================================== +.. sourcecode:: c++ + + template + inline SPROUT_CONSTEXPR ForwardIterator1 + find_end( + ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2 + ); + + template + inline SPROUT_CONSTEXPR ForwardIterator1 + find_end( + ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2, + BinaryPredicate pred + ); + +Effects +======================================== + +| Finds a subsequence of equal values in a sequence. + +Returns +======================================== + +| The last iterator i in the range [first1,last1 - (last2 - first2)) such that for any nonnegative integer ``n < (last2 - first2)``, the following corresponding conditions hold: ``*(i + n) == *(first2 + n)``, ``pred(*(i + n), *(first2 + n))``. +| Returns last1 if [first2,last2) is empty or if no such iterator is found. + +Examples +======================================== +.. sourcecode:: c++ + + #include + #include + #include + using namespace sprout; + + SPROUT_STATIC_CONSTEXPR auto input1 = array{{1, 2, 3, 4, 5, 1, 2, 3, 4, 5}}; + SPROUT_STATIC_CONSTEXPR auto input2 = array{{3, 4, 5}}; + SPROUT_STATIC_CONSTEXPR auto result = sprout::find_end(begin(input1), end(input1), begin(input2), end(input2)); + static_assert(result != end(input1), "found a subsequence equal to input2 from input1."); + static_assert(result - begin(input1) == 7, "a found position is 7."); + +Complexity +======================================== + +| At most ``(last2 - first2) * (last1 - first1 - (last2 - first2) + 1)`` applications of the corresponding predicate. +| Recursive function invocations in *O(logN)* (logarithmic) depth. + +Header +======================================== + +| ``sprout/algorithm/find_end.hpp`` +| Convenience header: ``sprout/algorithm.hpp`` + diff --git a/source/libs/sprout/algorithm/find_first_of.rst b/source/libs/sprout/algorithm/find_first_of.rst new file mode 100644 index 00000000..c5aa5b58 --- /dev/null +++ b/source/libs/sprout/algorithm/find_first_of.rst @@ -0,0 +1,62 @@ +.. _sprout-algorithm-find: +############################################################################### +find_first_of +############################################################################### + +Interface +======================================== +.. sourcecode:: c++ + + template + inline SPROUT_CONSTEXPR InputIterator1 + find_first_of( + InputIterator1 first1, InputIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2 + ); + + template + inline SPROUT_CONSTEXPR InputIterator1 + find_first_of( + InputIterator1 first1, InputIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2, + BinaryPredicate pred + ); + +Effects +======================================== + +| Finds an element that matches one of a set of values. + +Returns +======================================== + +| The first iterator i in the range [first1,last1) such that for some iterator j in the range [first2,last2) the following conditions hold: ``*i == *j``, ``pred(*i,*j)``. +| Returns last1 if [first2,last2) is empty or if no such iterator is found. + +Examples +======================================== +.. sourcecode:: c++ + + #include + #include + #include + using namespace sprout; + + SPROUT_STATIC_CONSTEXPR auto input1 = array{{1, 2, 3, 4, 5, 1, 2, 3, 4, 5}}; + SPROUT_STATIC_CONSTEXPR auto input2 = array{{3, 4, 5}}; + SPROUT_STATIC_CONSTEXPR auto result = sprout::find_first_of(begin(input1), end(input1), begin(input2), end(input2)); + static_assert(result != end(input1), "found an element equal to an one of input2 from input1."); + static_assert(result - begin(input1) == 2, "a found position is 2."); + +Complexity +======================================== + +| At most ``(last2 - first2) * (last1 - first1 - (last2 - first2) + 1)`` applications of the corresponding predicate. +| Recursive function invocations in *O(logN)* (logarithmic) depth. + +Header +======================================== + +| ``sprout/algorithm/find_first_of.hpp`` +| Convenience header: ``sprout/algorithm.hpp`` + diff --git a/source/libs/sprout/algorithm/find_if.rst b/source/libs/sprout/algorithm/find_if.rst index 4196b82f..e2ddd33f 100644 --- a/source/libs/sprout/algorithm/find_if.rst +++ b/source/libs/sprout/algorithm/find_if.rst @@ -30,7 +30,7 @@ Examples SPROUT_STATIC_CONSTEXPR auto input = array{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}; SPROUT_STATIC_CONSTEXPR auto result = sprout::find_if(begin(input), end(input), bind2nd(greater<>(), 7)); static_assert(result != end(input), "found a element greater than 7 from input."); - static_assert(*result == 8, "a found iterator is pointing to 8."); + static_assert(result - begin(input1) == 7, "a found position is 7."); Complexity ======================================== diff --git a/source/libs/sprout/algorithm/find_if_not.rst b/source/libs/sprout/algorithm/find_if_not.rst index c8797651..7239e987 100644 --- a/source/libs/sprout/algorithm/find_if_not.rst +++ b/source/libs/sprout/algorithm/find_if_not.rst @@ -30,7 +30,7 @@ Examples SPROUT_STATIC_CONSTEXPR auto input = array{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}; SPROUT_STATIC_CONSTEXPR auto result = sprout::find_if_not(begin(input), end(input), bind2nd(less<>(), 8)); static_assert(result != end(input), "found a element not less than 8 from input."); - static_assert(*result == 8, "a found iterator is pointing to 8."); + static_assert(result - begin(input1) == 7, "a found position is 7."); Complexity ======================================== diff --git a/source/libs/sprout/algorithm/index.rst b/source/libs/sprout/algorithm/index.rst index d49cf31e..5a543eed 100644 --- a/source/libs/sprout/algorithm/index.rst +++ b/source/libs/sprout/algorithm/index.rst @@ -17,6 +17,9 @@ Sprout.Algorithm find find_if find_if_not + find_end + find_first_of + adjacent_find .. _sprout-algorithm-non_modifying: *******************************************************************************