Introduction


Name convensions:

  1. Class: MyClass
  2. Function: myFunction
  3. variable, object: my_variable, my_class_object
    1. Private variable and object in class: my_private_variable_
    2. Private methods: my_private_method_
    3. Constant variable: k_const_variable
  4. Macro: MYMACRO

Customer methods in algorithms

std::sort
Defined in header <algorithm>
template< class RandomIt, class Compare >
void sort( RandomIt first, RandomIt last, Compare comp );
// Here comp is a function object
// OK to use lambda function
// OK to use a function name
// OK to use a functor (Not class name! but an object), e.g. CMP{} or CMP(), CMP is a class

compared with

std::priority_queue
Defined in header <queue>
template<
    class T,
    class Container = std::vector<T>,
    class Compare = std::less<typename Container::value_type>
> class priority_queue;
// Here Compare is a class
// OK to use class name, e.g. CMP

results matching ""

    No results matching ""