STAPL API Reference |
Modules Classes |
Initialize the elements in a view (e.g., stapl::generate()). Defined in stapl/algorithms/algorithm.hpp. More...
Functions | |
template<typename View0 , typename View1 > | |
void | stapl::copy (View0 const &vw0, View1 const &vw1) |
Copy the elements of the input view to the output view. More... | |
template<typename View0 , typename View1 , typename Size > | |
void | stapl::copy_n (View0 const &vw0, View1 const &vw1, Size n) |
Copy the first n elements from the input view to the output view. More... | |
template<typename View , typename Generator > | |
void | stapl::generate (View const &view, Generator gen) |
Assign each value of the input view to the result of calling the provided functor. More... | |
template<typename View , typename Generator > | |
void | stapl::generate_n (View const &view, size_t first_elem, size_t n, Generator gen) |
Assign the n values of the input view starting at the given element to the result of calling the provided functor. More... | |
template<typename View , typename Predicate > | |
void | stapl::replace_if (View &vw, Predicate pred, typename View::value_type const &new_value) |
Replace the values from the input view for which the given predicate returns true with the new value. More... | |
template<typename View > | |
void | stapl::replace (View &vw, typename View::value_type const &old_value, typename View::value_type const &new_value) |
Replace the given value in the input with the new value. More... | |
template<typename View0 , typename View1 , typename Predicate > | |
View1::iterator | stapl::replace_copy_if (View0 const &vw0, View1 const &vw1, Predicate pred, typename View0::value_type new_value) |
Copy the values from the input view to the output, except for those elements for which the given predicate returns true, which are replaced with the given value. More... | |
template<typename View , typename Size > | |
void | stapl::fill_n (View &vw, typename View::value_type value, Size n) |
Assigns the given value to the first n elements of the input view. More... | |
template<typename View > | |
void | stapl::fill (View const &vw, typename View::value_type value) |
Assigns the given value to the elements of the input view. More... | |
template<typename View > | |
void | stapl::swap_ranges (View &vw0, View &vw1) |
Swaps the elements of the two input views. More... | |
template<typename View0 , typename View1 > | |
View1::iterator | stapl::replace_copy (View0 &vw0, View1 &vw1, typename View0::value_type old_value, typename View0::value_type new_value) |
Copy the elements from the input to the output, replacing the given old_value with the new_value. More... | |
template<typename View0 , typename Function > | |
Function | stapl::for_each (const View0 &vw0, Function func) |
Applies the given functor to all of the elements in the input. More... | |
template<typename View0 , typename View1 , typename Function > | |
void | stapl::transform (const View0 &vw0, const View1 &vw1, Function func) |
Applies the given function to the input, and stores the result in the output. More... | |
template<typename View0 , typename View1 , typename View2 , typename Function > | |
void | stapl::transform (View0 &vw0, View1 &vw1, View2 &vw2, Function func) |
Applies the given function to the inputs, and stores the result in the output. More... | |
template<typename View > | |
void | stapl::prototype::fill (View &vw, typename View::value_type value) |
Assigns the given value to the elements of the input view. More... | |
template<typename View0 , typename Function > | |
Function | stapl::prototype::for_each (View0 const &vw0, Function func) |
Applies the given functor to all of the elements in the input. More... | |
template<typename View0 > | |
void | stapl::iota (View0 const &view, typename View0::value_type const &value) |
Initializes the elements of the view such that the first element is assigned value, the next element value+1, etc. More... | |
Initialize the elements in a view (e.g., stapl::generate()). Defined in stapl/algorithms/algorithm.hpp.
Modifies the elements in a view by assigning values that are:
void stapl::copy | ( | View0 const & | vw0, |
View1 const & | vw1 | ||
) |
Copy the elements of the input view to the output view.
vw0 | One-dimensional view of the input. |
vw1 | One-dimensional view of the output. |
This algorithm mutates the output.
void stapl::copy_n | ( | View0 const & | vw0, |
View1 const & | vw1, | ||
Size | n | ||
) |
Copy the first n elements from the input view to the output view.
vw0 | One-dimensional view of the input. |
vw1 | One-dimensional view of the output. |
n | Number of elements to copy. |
This algorithm mutates the output.
void stapl::generate | ( | View const & | view, |
Generator | gen | ||
) |
Assign each value of the input view to the result of calling the provided functor.
view | One-dimensional view of the input. |
gen | Nullary functor which is called to generate elements. |
This algorithm mutates the input view.
void stapl::generate_n | ( | View const & | view, |
size_t | first_elem, | ||
size_t | n, | ||
Generator | gen | ||
) |
Assign the n values of the input view starting at the given element to the result of calling the provided functor.
view | One-dimensional view of the input. |
first_elem | First element to fill with a generated value. |
n | Number of elements to fill with generated values. |
gen | Nullary functor which is called to generate elements. |
This algorithm mutates the input view.
void stapl::replace_if | ( | View & | vw, |
Predicate | pred, | ||
typename View::value_type const & | new_value | ||
) |
Replace the values from the input view for which the given predicate returns true with the new value.
vw | One-dimensional view of the input. |
pred | Unary functor which returns true for replaced elements. |
new_value | Value used to replace elements. |
This algorithm mutates the input view.
void stapl::replace | ( | View & | vw, |
typename View::value_type const & | old_value, | ||
typename View::value_type const & | new_value | ||
) |
Replace the given value in the input with the new value.
vw | One-dimensional view of the input. |
old_value | Value replaced in the input. |
new_value | Value used to replace old values. |
This algorithm mutates the input view. The comparison is done with stapl::equal_to.
View1::iterator stapl::replace_copy_if | ( | View0 const & | vw0, |
View1 const & | vw1, | ||
Predicate | pred, | ||
typename View0::value_type | new_value | ||
) |
Copy the values from the input view to the output, except for those elements for which the given predicate returns true, which are replaced with the given value.
vw0 | One-dimensional view of the input. |
vw1 | One-dimensional view of the output. |
pred | Unary functor which returns true for replaced elements. |
new_value | Value used to replace elements for which the functor returns true. |
This algorithm mutates the output view. The input and output views must be the same size.
void stapl::fill_n | ( | View & | vw, |
typename View::value_type | value, | ||
Size | n | ||
) |
Assigns the given value to the first n elements of the input view.
vw | One-dimensional view of the input. |
value | The value to fill into the input. |
n | Number of elements to fill. |
This algorithm mutates the input view. The input must be at least n in size.
void stapl::fill | ( | View const & | vw, |
typename View::value_type | value | ||
) |
Assigns the given value to the elements of the input view.
vw | One-dimensional view of the input. |
value | The value to fill into the input. |
This algorithm mutates the input view.
void stapl::swap_ranges | ( | View & | vw0, |
View & | vw1 | ||
) |
Swaps the elements of the two input views.
vw0 | One-dimensional view of the first input. |
vw1 | One-dimensional view of the second input. |
This algorithm mutates both input views, and requires that both views are the same size.
View1::iterator stapl::replace_copy | ( | View0 & | vw0, |
View1 & | vw1, | ||
typename View0::value_type | old_value, | ||
typename View0::value_type | new_value | ||
) |
Copy the elements from the input to the output, replacing the given old_value with the new_value.
vw0 | One-dimensional view of the input. |
vw1 | One-dimensional view of the output. |
old_value | The old value to replace. |
new_value | The new value to substitute for occurrences of old_value. |
This algorithm mutates the output view, and requires a view with iterator support. It uses stapl::equal_to for comparisons.
Function stapl::for_each | ( | const View0 & | vw0, |
Function | func | ||
) |
Applies the given functor to all of the elements in the input.
vw0 | One-dimensional view over the input. |
func | Unary functor to apply to the elements. |
This algorithm will mutate the input view.
void stapl::transform | ( | const View0 & | vw0, |
const View1 & | vw1, | ||
Function | func | ||
) |
Applies the given function to the input, and stores the result in the output.
vw0 | One-dimensional view over the input. |
vw1 | One-dimensional view over the output. |
func | Unary function which is applied to all of the input elements. |
This algorithm mutates the output view only.
void stapl::transform | ( | View0 & | vw0, |
View1 & | vw1, | ||
View2 & | vw2, | ||
Function | func | ||
) |
Applies the given function to the inputs, and stores the result in the output.
vw0 | One-dimensional view over the first input. |
vw1 | One-dimensional view over the second input. |
vw2 | One-dimensional view over the output. |
func | Binary function which is applied to all of the input elements. |
This algorithm mutates the output view only.
void stapl::prototype::fill | ( | View & | vw, |
typename View::value_type | value | ||
) |
Assigns the given value to the elements of the input view.
vw | One-dimensional view of the input. |
value | The value to fill into the input. |
This algorithm mutates the input view.
Function stapl::prototype::for_each | ( | View0 const & | vw0, |
Function | func | ||
) |
Applies the given functor to all of the elements in the input.
vw0 | One-dimensional view over the input. |
func | Unary functor to apply to the elements. |
This algorithm will mutate the input view.
void stapl::iota | ( | View0 const & | view, |
typename View0::value_type const & | value | ||
) |
Initializes the elements of the view such that the first element is assigned value, the next element value+1, etc.
view | A one-dimensional view over elements of a numeric type that are going to be initialized. |
value | The first value in the sequence assigned to the elements of the input view. |