[[functional-programming]]

= Functional programming

To use these functions, you need to include:

[source,cpp]
----
#include <msm/front/euml/stl.hpp>
----

or the specified header in the following tables.

== STL algorithms in querying.hpp

.STL algorithms in querying.hpp
[cols="2,1",options="header"]
|===
|Function
|Functor

|`find_(first, last, value)`
|`Find_`

|`find_if_(first, last, value)`
|`FindIf_`

|`lower_bound_(first, last, value [,op^a^])`
|`LowerBound_`

|`upper_bound_(first, last, value [,op^a^])`
|`UpperBound_`

|`equal_range_(first, last, value [,op^a^])`
|`EqualRange_`

|`binary_search_(first, last, value [,op^a^])`
|`BinarySearch_`

|`min_element_(first, last[,op^a^])`
|`MinElement_`

|`max_element_(first, last[,op^a^])`
|`MaxElement_`

|`adjacent_find_(first, last[,op^a^])`
|`AdjacentFind_`

|`find_end_(first1, last1, first2, last2 [,op^a^])`
|`FindEnd_`

|`find_first_of_(first1, last1, first2, last2 [,op^a^])`
|`FindFirstOf_`

|`equal_(first1, last1, first2 [,op^a^])`
|`Equal_`

|`search_(first1, last1, first2, last2 [,op^a^])`
|`Search_`

|`includes_(first1, last1, first2, last2 [,op^a^])`
|`Includes_`

|`lexicographical_compare_(first1, last1, first2, last2 [,op^a^])`
|`LexicographicalCompare_`

|`count_(first, last, value [,size])`
|`Count_`

|`count_if_(first, last, op^a^ [,size])`
|`CountIf_`

|`distance_(first, last)`
|`Distance_`

|`mismatch_(first1, last1, first2 [,op^a^])`
|`Mismatch_`
|===

== STL algorithms in iteration.hpp

.STL algorithms in iteration.hpp
[cols="2,1",options="header"]
|===
|Function
|Functor

|`for_each_(first, last, unary op^a^)`
|`ForEach_`

|`accumulate_(first, last, init [,op^a^])`
|`Accumulate_`
|===

== STL algorithms in transformation.hpp

.STL algorithms in transformation.hpp
[cols="2,1",options="header"]
|===
|Function
|Functor

|`copy_(first, last, result)`
|`Copy_`

|`copy_backward_(first, last, result)`
|`CopyBackward_`

|`reverse_(first, last)`
|`Reverse_`

|`reverse_copy_(first, last, result)`
|`ReverseCopy_`

|`remove_(first, last, value)`
|`Remove_`

|`remove_if_(first, last, op^a^)`
|`RemoveIf_`

|`remove_copy_(first, last, output, value)`
|`RemoveCopy_`

|`remove_copy_if_(first, last, output, op^a^)`
|`RemoveCopyIf_`

|`fill_(first, last, value)`
|`Fill_`

|`fill_n_(first, size, value)^b^`
|`FillN_`

|`generate_(first, last, generator^a^)`
|`Generate_`

|`generate_n_(first, size, generator^a^)^b^`
|`GenerateN_`

|`unique_(first, last [,op^a^])`
|`Unique_`

|`unique_copy_(first, last, output [,op^a^])`
|`UniqueCopy_`

|`random_shuffle_(first, last [,op^a^])`
|`RandomShuffle_`

|`rotate_copy_(first, middle, last, output)`
|`RotateCopy_`

|`partition_(first, last [,op^a^])`
|`Partition_`

|`stable_partition_(first, last [,op^a^])`
|`StablePartition_`

|`stable_sort_(first, last [,op^a^])`
|`StableSort_`

|`sort_(first, last [,op^a^])`
|`Sort_`

|`partial_sort_(first, middle, last [,op^a^])`
|`PartialSort_`

|`partial_sort_copy_(first, last, res_first, res_last [,op^a^])`
|`PartialSortCopy_`

|`nth_element_(first, nth, last [,op^a^])`
|`NthElement_`

|`merge_(first1, last1, first2, last2, output [,op^a^])`
|`Merge_`

|`inplace_merge_(first, middle, last [,op^a^])`
|`InplaceMerge_`

|`set_union_(first1, last1, first2, last2, output [,op^a^])`
|`SetUnion_`

|`push_heap_(first, last [,op^a^])`
|`PushHeap_`

|`pop_heap_(first, last [,op^a^])`
|`PopHeap_`

|`make_heap_(first, last [,op^a^])`
|`MakeHeap_`

|`sort_heap_(first, last [,op^a^])`
|`SortHeap_`

|`next_permutation_(first, last [,op^a^])`
|`NextPermutation_`

|`prev_permutation_(first, last [,op^a^])`
|`PrevPermutation_`

|`inner_product_(first1, last1, first2, init [,op1^a^] [,op2^a^])`
|`InnerProduct_`

|`partial_sum_(first, last, output [,op^a^])`
|`PartialSum_`

|`adjacent_difference_(first, last, output [,op^a^])`
|`AdjacentDifference_`

|`replace_(first, last, old_value, new_value)`
|`Replace_`

|`replace_if_(first, last, op^a^, new_value)`
|`ReplaceIf_`

|`replace_copy_(first, last, result, old_value, new_value)`
|`ReplaceCopy_`

|`replace_copy_if_(first, last, result, op^a^, new_value)`
|`ReplaceCopyIf_`

|`rotate_(first, middle, last)^b^`
|`Rotate_`
|===

== STL container methods (common) in container.hpp

.STL container methods (common) in container.hpp
[cols="2,1",options="header"]
|===
|Function
|Functor

|`container::reference front_(container)`
|`Front_`

|`container::reference back_(container)`
|`Back_`

|`container::iterator begin_(container)`
|`Begin_`

|`container::iterator end_(container)`
|`End_`

|`container::reverse_iterator rbegin_(container)`
|`RBegin_`

|`container::reverse_iterator rend_(container)`
|`REnd_`

|`void push_back_(container, value)`
|`Push_Back_`

|`void pop_back_(container, value)`
|`Pop_Back_`

|`void push_front_(container, value)`
|`Push_Front_`

|`void pop_front_(container, value)`
|`Pop_Front_`

|`void clear_(container)`
|`Clear_`

|`size_type capacity_(container)`
|`Capacity_`

|`size_type size_(container)`
|`Size_`

|`size_type max_size_(container)`
|`Max_Size_`

|`void reserve_(container, value)`
|`Reserve_`

|`void resize_(container, value)`
|`Resize_`

|`iterator insert_(container, pos, value)`
|`Insert_`

|`void insert_(container, pos, first, last)`
|`Insert_`

|`void insert_(container, pos, number, value)`
|`Insert_`

|`void swap_(container, other_container)`
|`Swap_`

|`void erase_(container, pos)`
|`Erase_`

|`void erase_(container, first, last)`
|`Erase_`

|`bool empty_(container)`
|`Empty_`
|===

== std::list methods in container.hpp

.std::list methods in container.hpp
[cols="2,1",options="header"]
|===
|Function
|Functor

|`void list_remove_(container, value)`
|`ListRemove_`

|`void list_remove_if_(container, op^a^)`
|`ListRemove_If_`

|`void list_merge_(container, other_list)`
|`ListMerge_`

|`void list_merge_(container, other_list, op^a^)`
|`ListMerge_`

|`void splice_(container, iterator, other_list)`
|`Splice_`

|`void splice_(container, iterator, other_list, iterator)`
|`Splice_`

|`void splice_(container, iterator, other_list, first, last)`
|`Splice_`

|`void list_reverse_(container)`
|`ListReverse_`

|`void list_unique_(container)`
|`ListUnique_`

|`void list_unique_(container, op^a^)`
|`ListUnique_`

|`void list_sort_(container)`
|`ListSort_`

|`void list_sort_(container, op^a^)`
|`ListSort_`
|===

== STL associative container methods in container.hpp

.Associative container methods in container.hpp
[cols="2,1",options="header"]
|===
|Function
|Functor

|`iterator insert_(container, pos, value)`
|`Insert_`

|`void insert_(container, first, last)`
|`Insert_`

|`pair<iterator, bool> insert_(container, value)`
|`Insert_`

|`void associative_erase_(container, pos)`
|`Associative_Erase_`

|`void associative_erase_(container, first, last)`
|`Associative_Erase_`

|`size_type associative_erase_(container, key)`
|`Associative_Erase_`

|`iterator associative_find_(container, key)`
|`Associative_Find_`

|`size_type associative_count_(container, key)`
|`AssociativeCount_`

|`iterator associative_lower_bound_(container, key)`
|`Associative_Lower_Bound_`

|`iterator associative_upper_bound_(container, key)`
|`Associative_Upper_Bound_`

|`pair<iterator, iterator> associative_equal_range_(container, key)`
|`Associative_Equal_Range_`
|===

== std::pair in container.hpp

.std::pair in container.hpp
[cols="2,1",options="header"]
|===
|Function
|Functor

|`first_type first_(pair<T1, T2>)`
|`First_`

|`second_type second_(pair<T1, T2>)`
|`Second_`
|===

== std::string methods in container.hpp

.std::string methods in container.hpp
[cols="1,2,1",options="header"]
|===
|std::string method
|eUML function
|Functor

|`substr(size_type pos, size_type size)`
|`string substr_(container, pos, length)`
|`Substr_`

|`int compare(string)`
|`int string_compare_(container, another_string)`
|`StringCompare_`

|`int compare(char*)`
|`int string_compare_(container, another_string)`
|`StringCompare_`

|`int compare(size_type pos, size_type size, string)`
|`int string_compare_(container, pos, size, another_string)`
|`StringCompare_`

|`int compare(size_type pos, size_type size, string, size_type length)`
|`int string_compare_(container, pos, size, another_string, length)`
|`StringCompare_`

|`string& append(const string&)`
|`string& append_(container, another_string)`
|`Append_`

|`string& append(charT*)`
|`string& append_(container, another_string)`
|`Append_`

|`string& append(string, size_type pos, size_type size)`
|`string& append_(container, other_string, pos, size)`
|`Append_`

|`string& append(charT*, size_type size)`
|`string& append_(container, another_string, length)`
|`Append_`

|`string& append(size_type size, charT)`
|`string& append_(container, size, char)`
|`Append_`

|`string& append(iterator begin, iterator end)`
|`string& append_(container, begin, end)`
|`Append_`

|`string& insert(size_type pos, charT*)`
|`string& string_insert_(container, pos, other_string)`
|`StringInsert_`

|`string& insert(size_type pos, charT*, size_type n)`
|`string& string_insert_(container, pos, other_string, n)`
|`StringInsert_`

|`string& insert(size_type pos, size_type n, charT c)`
|`string& string_insert_(container, pos, n, c)`
|`StringInsert_`

|`string& insert(size_type pos, const string&)`
|`string& string_insert_(container, pos, other_string)`
|`StringInsert_`

|`string& insert(size_type pos, const string&, size_type pos1, size_type n)`
|`string& string_insert_(container, pos, other_string, pos1, n)`
|`StringInsert_`

|`string& erase(size_type pos=0, size_type n=npos)`
|`string& string_erase_(container, pos, n)`
|`StringErase_`

|`string& assign(const string&)`
|`string& string_assign_(container, another_string)`
|`StringAssign_`

|`string& assign(const charT*)`
|`string& string_assign_(container, another_string)`
|`StringAssign_`

|`string& assign(const string&, size_type pos, size_type n)`
|`string& string_assign_(container, another_string, pos, n)`
|`StringAssign_`

|`string& assign(const charT*, size_type n)`
|`string& string_assign_(container, another_string, n)`
|`StringAssign_`

|`string& assign(size_type n, charT c)`
|`string& string_assign_(container, n, c)`
|`StringAssign_`

|`string& assign(iterator first, iterator last)`
|`string& string_assign_(container, first, last)`
|`StringAssign_`

|`string& replace(size_type pos, size_type n, const string&)`
|`string& string_replace_(container, pos, n, another_string)`
|`StringReplace_`

|`string& replace(size_type pos, size_type n, const charT*, size_type n1)`
|`string& string_replace_(container, pos, n, another_string, n1)`
|`StringReplace_`

|`string& replace(size_type pos, size_type n, const charT*)`
|`string& string_replace_(container, pos, n, another_string)`
|`StringReplace_`

|`string& replace(size_type pos, size_type n, size_type n1, charT c)`
|`string& string_replace_(container, pos, n, n1, c)`
|`StringReplace_`

|`string& replace(iterator first, iterator last, const string&)`
|`string& string_replace_(container, first, last, another_string)`
|`StringReplace_`

|`string& replace(iterator first, iterator last, const charT*, size_type n)`
|`string& string_replace_(container, first, last, another_string, n)`
|`StringReplace_`

|`string& replace(iterator first, iterator last, const charT*)`
|`string& string_replace_(container, first, last, another_string)`
|`StringReplace_`

|`string& replace(iterator first, iterator last, size_type n, charT c)`
|`string& string_replace_(container, first, last, n, c)`
|`StringReplace_`

|`string& replace(iterator first, iterator last, iterator f, iterator l)`
|`string& string_replace_(container, first, last, f, l)`
|`StringReplace_`

|`const charT* c_str()`
|`const charT* c_str_(container)`
|`CStr_`

|`const charT* data()`
|`const charT* string_data_(container)`
|`StringData_`

|`size_type copy(charT* buf, size_type n, size_type pos = 0)`
|`size_type string_copy_(container, buf, n, pos)`; `size_type string_copy_(container, buf, n)`
|`StringCopy_`

|`size_type find(charT* s, size_type pos, size_type n)`
|`size_type string_find_(container, s, pos, n)`
|`StringFind_`

|`size_type find(charT* s, size_type pos=0)`
|`size_type string_find_(container, s, pos)`; `size_type string_find_(container, s)`
|`StringFind_`

|`size_type find(const string& s, size_type pos=0)`
|`size_type string_find_(container, s, pos)`; `size_type string_find_(container, s)`
|`StringFind_`

|`size_type find(charT c, size_type pos=0)`
|`size_type string_find_(container, c, pos)`; `size_type string_find_(container, c)`
|`StringFind_`

|`size_type rfind(charT* s, size_type pos, size_type n)`
|`size_type string_rfind_(container, s, pos, n)`
|`StringRFind_`

|`size_type rfind(charT* s, size_type pos=npos)`
|`size_type string_rfind_(container, s, pos)`; `size_type string_rfind_(container, s)`
|`StringRFind_`

|`size_type rfind(const string& s, size_type pos=npos)`
|`size_type string_rfind_(container, s, pos)`; `size_type string_rfind_(container, s)`
|`StringRFind_`

|`size_type rfind(charT c, size_type pos=npos)`
|`size_type string_rfind_(container, c, pos)`; `size_type string_rfind_(container, c)`
|`StringRFind_`

|`size_type find_first_of(charT* s, size_type pos, size_type n)`
|`size_type find_first_of_(container, s, pos, n)`
|`StringFindFirstOf_`

|`size_type find_first_of(charT* s, size_type pos=0)`
|`size_type find_first_of_(container, s, pos)`; `size_type find_first_of_(container, s)`
|`StringFindFirstOf_`

|`size_type find_first_of(const string& s, size_type pos=0)`
|`size_type find_first_of_(container, s, pos)`; `size_type find_first_of_(container, s)`
|`StringFindFirstOf_`

|`size_type find_first_of(charT c, size_type pos=0)`
|`size_type find_first_of_(container, c, pos)`; `size_type find_first_of_(container, c)`
|`StringFindFirstOf_`

|`size_type find_first_not_of(charT* s, size_type pos, size_type n)`
|`size_type find_first_not_of_(container, s, pos, n)`
|`StringFindFirstNotOf_`

|`size_type find_first_not_of(charT* s, size_type pos=0)`
|`size_type find_first_not_of_(container, s, pos)`; `size_type find_first_not_of_(container, s)`
|`StringFindFirstNotOf_`

|`size_type find_first_not_of(const string& s, size_type pos=0)`
|`size_type find_first_not_of_(container, s, pos)`; `size_type find_first_not_of_(container, s)`
|`StringFindFirstNotOf_`

|`size_type find_first_not_of(charT c, size_type pos=0)`
|`size_type find_first_not_of_(container, c, pos)`; `size_type find_first_not_of_(container, c)`
|`StringFindFirstNotOf_`

|`size_type find_last_of(charT* s, size_type pos, size_type n)`
|`size_type find_last_of_(container, s, pos, n)`
|`StringFindLastOf_`

|`size_type find_last_of(charT* s, size_type pos=npos)`
|`size_type find_last_of_(container, s, pos)`; `size_type find_last_of_(container, s)`
|`StringFindLastOf_`

|`size_type find_last_of(const string& s, size_type pos=npos)`
|`size_type find_last_of_(container, s, pos)`; `size_type find_last_of_(container, s)`
|`StringFindLastOf_`

|`size_type find_last_of(charT c, size_type pos=npos)`
|`size_type find_last_of_(container, c, pos)`; `size_type find_last_of_(container, c)`
|`StringFindLastOf_`

|`size_type find_last_not_of(charT* s, size_type pos, size_type n)`
|`size_type find_last_not_of_(container, s, pos, n)`
|`StringFindLastNotOf_`

|`size_type find_last_not_of(charT* s, size_type pos=npos)`
|`size_type find_last_not_of_(container, s, pos)`; `size_type find_last_of_(container, s)`
|`StringFindLastNotOf_`

|`size_type find_last_not_of(const string& s, size_type pos=npos)`
|`size_type find_last_not_of_(container, s, pos)`; `size_type find_last_not_of_(container, s)`
|`StringFindLastNotOf_`

|`size_type find_last_not_of(charT c, size_type pos=npos)`
|`size_type find_last_not_of_(container, c, pos)`; `size_type find_last_not_of_(container, c)`
|`StringFindLastNotOf_`
|===
