- Containers
- Pointers and References
- Expressions
- Functions
- Type Casting
- Idioms
- Language Concepts
- Framework and Libraries
- Performance Analysis and Debugging Tool
- Package Managers
- Severals
- Standarts
- My Other Awesome Lists
- Contributing
- Contributors
Except for the std::vector<bool> partial specialization, the elements are stored contiguously, which means that elements can be accessed not only through iterators, but also using offsets to regular pointers to elements.
std::vector<int> ivec = { 1, 2, 3, 4, 5 };
//lambda expression
auto print = [](const int& n) { std::cout << n << ' '; };
std::for_each(ivec.cbegin(), ivec.cend(), print);
std::cout << std::endl;
std::for_each(ivec.crbegin(), ivec.crend(), print);std::list is a container that supports constant time insertion and removal of elements from anywhere in the container. Fast random access is not supported. It is usually implemented as a doubly-linked list. Compared to std::forward_list this container provides bidirectional iteration capability while being less space efficient.
std::list<int> ilist = { 5, 7, 11, 13 };
for (int n : ilist)
std::cout << n << ", ";
std::cout<<"\n-----------------\n";
ilist.push_front(0);
ilist.push_back(-1);
std::for_each(ilist.cbegin(), ilist.cend(), [](auto val) { std::cout << val << ", "; });
std::cout << "\n-----------------\n";
//insert with using initializer list
ilist.insert(ilist.cend(), { 4, 3, 2, 1 });
for (auto it = ilist.cbegin(); it != ilist.cend(); ++it) {
std::cout << *it << ", ";
}Smart pointers enable automatic, exception-safe, object lifetime management.
std::unique_ptr is a smart pointer that owns (is responsible for) and manages another object via a pointer and subsequently disposes of that object when the unique_ptr goes out of scope.
{
unique_ptr<ClassName> uptr(new ClassName);
uptr -> method_name();
//....using
} //destructing uptr destroys the ClassName object.Lambda expression in computer programming, also called an anonymous function, is a defined function not bound to an identifier.
auto make_function(int& iparam)
{
return [&] { std::cout << iparam << std::endl; };
}
int main()
{
int ival = 2;
auto f = make_function(ival); // the use of iparam in f binds directly to ival
f();
ival = 3;
f();
return 0;
}- a
glvalue("generalized" lvalue) is an expression whose evaluation determines the identity of an object or function. - a
prvalue("pure" rvalue) is an expression whose evaluation. - an
xvalue(an "eXpiring" value) is a glvalue that denotes an object whose resources can be reused. - an
lvalueis a glvalue that is not an xvalue.
Some programming languages use the idea of l-values and r-values, deriving from the typical mode of evaluation on the left and right-hand side of an assignment statement. An l-value refers to an object that persists beyond a single expression. An r-value is a temporary value that does not persist beyond the expression that uses it.
void foo();
int main() {
int ivala; // Expression 'ivala' is lvalue
int &ivalb{ivala}; // Expression 'ivalb' is lvalue
// Expression 'foo' is lvalue
// address may be taken by built-in address-of operator
void (*ptrfoo)() = &foo;a glvalue ("generalized" lvalue) is an expression whose evaluation determines the identity of an object or function.
Converts between types using a combination of implicit and user-defined conversions.
Safely converts pointers and references to classes up, down, and sideways along the inheritance hierarchy.
Converts between types with different cv-qualification.
RAII (Resource acquisition is initialization)
PIMPL (Pointer to Implementation)
CRTP (Curiously recurring template pattern)
RTTI (Run-time type information)
SFINAE (Substitution failure is not an error)
- Catch2 - A modern, C++ native, test framework for unit-tests, TDD and BDD - using C++14, C++17 and later.
- Google Test - Google Testing and Mocking Framework
- POCO - The POCO C++ Libraries are powerful cross-platform open-source C++ libraries for building network- and internet-based applications that run on desktop, server, mobile, IoT, and embedded systems.
- gRPC - A high performance, open source universal RPC framework.
- Orbit - Orbit is a standalone profiler and debugging tool for Windows and Linux. Its main purpose is to help developers understand and visualize the execution flow of a complex application.
- Tracy Profiler - A real time, nanosecond resolution, remote telemetry, hybrid frame and sampling profiler for games and other applications.
- vcpkg - vcpkg is a free C/C++ package manager for acquiring and managing libraries.
- Conan - The open-source C and C++ package manager.
- Doxygen - Doxygen is a widely-used documentation generator tool in software development.
- {fmt} - A modern formatting library.
- JSON for Modern C++ - JSON for Modern C++.
- pybind11 - Seamless operability between C++11 and Python.
- spdlog - Fast C++ logging library.
- MSVC & GCC & Clang - installation step of MSVC/GCC/Clang compiler in Windows
- GCC & Clang - installation step of GCC/Clang compiler in Linux
- OnlineGDB - Online compiler and debugger for C/C++
You can access the my other awesome lists here
Contributions of any kind welcome, just follow the guidelines!
