[ Return types ](/w/cpp/algorithm/ranges#Return_types "cpp/algorithm/ranges")  
|  [ ranges::in_fun_result
](/w/cpp/algorithm/ranges/return_types/in_fun_result
"cpp/algorithm/ranges/return types/in fun result")  
---  
[ ranges::in_in_result  ](/w/cpp/algorithm/ranges/return_types/in_in_result
"cpp/algorithm/ranges/return types/in in result")  
[ ranges::in_found_result
](/w/cpp/algorithm/ranges/return_types/in_found_result
"cpp/algorithm/ranges/return types/in found result")  
  
|  [ ranges::in_out_result
](/w/cpp/algorithm/ranges/return_types/in_out_result
"cpp/algorithm/ranges/return types/in out result")  
---  
[ ranges::in_in_out_result
](/w/cpp/algorithm/ranges/return_types/in_in_out_result
"cpp/algorithm/ranges/return types/in in out result")  
  
  
  
|  [ ranges::in_out_out_result
](/w/cpp/algorithm/ranges/return_types/in_out_out_result
"cpp/algorithm/ranges/return types/in out out result")  
---  
[ ranges::min_max_result
](/w/cpp/algorithm/ranges/return_types/min_max_result
"cpp/algorithm/ranges/return types/min max result")  
  
  
  
|  [ ranges::out_value_result
](/w/cpp/algorithm/ranges/return_types/out_value_result
"cpp/algorithm/ranges/return types/out value result") (C++23)  
---  
[ ranges::in_value_result
](/w/cpp/algorithm/ranges/return_types/in_value_result
"cpp/algorithm/ranges/return types/in value result") (C++23)  
  
  
  
[ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/algorithm/ranges/navbar_content&action=edit)

C++20 provides [ constrained ](/w/cpp/language/constraints
"cpp/language/constraints") versions of most algorithms in the namespace `
std::ranges ` . In these algorithms, a range can be specified as either an [
iterator ](/w/cpp/iterator/input_or_output_iterator "cpp/iterator/input or
output iterator") \- [ sentinel ](/w/cpp/iterator/sentinel_for
"cpp/iterator/sentinel for") pair or as a single [ ` range `
](/w/cpp/ranges/range "cpp/ranges/range") argument, and projections and
pointer-to-member callables are supported. Additionally, the [ return types
](/w/cpp/algorithm/ranges#Return_types "cpp/algorithm/ranges") of most
algorithms have been changed to return all potentially useful information
computed during the execution of the algorithm.

##  Contents

  * 1  Constrained algorithms 
    * 1.1  Non-modifying sequence operations 
    * 1.2  Modifying sequence operations 
    * 1.3  Partitioning operations 
    * 1.4  Sorting operations 
    * 1.5  Binary search operations (on sorted ranges) 
    * 1.6  Set operations (on sorted ranges) 
    * 1.7  Heap operations 
    * 1.8  Minimum/maximum operations 
    * 1.9  Permutation operations 
  * 2  Constrained numeric operations 
  * 3  Constrained fold operations 
  * 4  Constrained uninitialized memory algorithms 
  * 5  Constrained random number algorithms 
  * 6  Return types 
  * 7  Notes 

  
---  
  
###  [ [ edit
](/mwiki/index.php?title=cpp/algorithm/ranges&action=edit&section=1 "Edit
section: Constrained algorithms") ]  Constrained algorithms

Defined in header ` [ <algorithm> ](/w/cpp/header/algorithm
"cpp/header/algorithm") `  
---  
Defined in namespace ` std::ranges `  
  
#####  Non-modifying sequence operations  
  
[ ranges::all_of  ranges::any_of  ranges::none_of  ](/w/cpp/algorithm/ranges/all_any_none_of "cpp/algorithm/ranges/all any none of") (C++20)  (C++20)  (C++20)  |  checks if a predicate is  true  for all, any or none of the elements in a range   
(niebloid)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/algorithm/ranges/dsc_all_any_none_of&action=edit)  
[ ranges::for_each  ](/w/cpp/algorithm/ranges/for_each "cpp/algorithm/ranges/for each") (C++20)  |  applies a function to a range of elements   
(niebloid)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/algorithm/ranges/dsc_for_each&action=edit)  
[ ranges::for_each_n  ](/w/cpp/algorithm/ranges/for_each_n "cpp/algorithm/ranges/for each n") (C++20)  |  applies a function object to th