Introduction
Name convensions:
- Class: MyClass
- Function: myFunction
- variable, object: my_variable, my_class_object
- Private variable and object in class: my_private_variable_
- Private methods: my_private_method_
- Constant variable: k_const_variable
- 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