Skip to content

Instantly share code, notes, and snippets.

@vilbeyli
Last active May 9, 2018 01:57
Show Gist options
  • Save vilbeyli/c21c00fe8e8b33d58f8e07bffeca5381 to your computer and use it in GitHub Desktop.
Save vilbeyli/c21c00fe8e8b33d58f8e07bffeca5381 to your computer and use it in GitHub Desktop.

A Quick Cheat-sheet for std::algorithms (WIP)

Notes compiled from 105 STL Algorithms in Less Than an Hour - Jonathan Boccara [ACCU 2018]

QUERY ELEMENT

  • Searching all:

     all_of()
     any_of()
     none_of()
    
  • Search single element:

    • Not sorted:

      find()
      adjacent_find()
      
    • Sorted:

      equal_range()
      lower_bound()
      upper_bound()
      binary_search()
      
  • Search a range of elements:

      search()
      find_end()
      find_first_of()
    
  • Search a relative value:

      iterator max_element()
      iterator min_element()
      std::pair<iterator, iterator> minmax_element()
    

CONTAINER INITIALIZATION

std::fill(first, last, value)
std::generate(first, last, f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment