Authors

Miriam Castellanos

Editor and senior C++ engineer

Answers
96
Writes
Language, Standard Library, Templates, Performance, Concurrency, Standards
Reply-to
hello@cpp-next.com

Miriam Castellanos has written C++ for a living for sixteen years, most of them on a large simulation codebase that she helped move from C++03 to C++11, then to C++17 and C++20, one compiler upgrade at a time. She keeps a running list of the advice she had to unlearn on the way, and many of the guides here start from it.

As editor she writes the Language, Standard Library, Templates, Performance, Concurrency and Standards sections, edits every guide, and checks each code sample under the standard it names.

Answers 96, newest first

  1. std::vector Explained: How the Dynamic Array WorksLanguage ·
  2. Function Type Explained: Signatures Without the BodyTemplates ·
  3. assert in C++: how assert and static_assert workLanguage · · C++17
  4. Binary search in C++: code and std::binary_searchStandard Library · · C++17
  5. bool in C++: true, false and how to use themLanguage · · C++17
  6. cin in C++: read numbers, words and linesStandard Library · · C++17
  7. const in C++: variables, pointers, references, methodsLanguage · · C++17
  8. constexpr in C++: variables, functions and static constexprLanguage · · C++17
  9. C++ array: declare, initialize and get the lengthLanguage · · C++17
  10. C++ class: how to define one and create objectsLanguage · · C++17
  11. C++ constructor: default, parameterized, copy and moveLanguage · · C++11
  12. continue in C++: skip to the next loop iterationLanguage · · C++17
  13. C++ cout: how to print with std::coutStandard Library · · C++17
  14. C++ data structures: which container to useStandard Library · · C++17
  15. Data types in C++: int, double, char, bool and moreLanguage · · C++17
  16. C++ do while loop: syntax, examples and do while vs whileLanguage · · C++17
  17. C++ enum and enum class: declare, convert, switchLanguage · · C++11
  18. C++ friend class and friend function: syntax and rulesLanguage · · C++17
  19. C++ function pointer: syntax, callbacks and examplesLanguage · · C++17
  20. C++ functions: syntax, calling and overloadingLanguage · · C++17
  21. C++ getline: how to read a whole line of inputStandard Library · · C++11
  22. C++ ifstream: how to open and read a fileStandard Library · · C++17
  23. Inheritance in C++: base and derived classesLanguage · · C++17
  24. C++ initializer list: member lists and std::initializer_listLanguage · · C++17
  25. C++ iterator: how begin() and end() workStandard Library · · C++17
  26. C++ linked list: write one, then use std::listStandard Library · · C++17
  27. C++ main function: int main(), argc and argvLanguage · · C++17
  28. memcpy in C++: how std::memcpy works and when to use itPerformance · · C++17
  29. C++ namespace: declare, nest, alias and reopenLanguage · · C++17
  30. C++ OOPs concepts: the four ideas, with codeLanguage · · C++17
  31. C++ operator overloading: signatures, member or friendLanguage · · C++20
  32. C++ operator precedence: table, rules and pitfallsLanguage · · C++17
  33. C++ operators: the full list with examplesLanguage · · C++17
  34. C++ pair: what std::pair is and how to use itStandard Library · · C++17
  35. C++ queue: how std::queue works, with examplesStandard Library · · C++11
  36. C++ random number: how to generate one in a rangeStandard Library · · C++11
  37. C++ split string: 3 ways with code (getline, find, views)Standard Library · · C++17
  38. Stack in C++: how std::stack works, with examplesStandard Library · · C++17
  39. C++ string (std::string) explained with examplesStandard Library · · C++17
  40. C++ string comparison: ==, compare() and strcmpStandard Library · · C++17
  41. C++ string concatenation: +, += and append()Standard Library · · C++17
  42. C++ string find: how to find a substring and check nposStandard Library · · C++17
  43. C++ string length: size(), length() and strlenStandard Library · · C++17
  44. C++ struct vs class: the only two differencesLanguage · · C++17
  45. C++ ternary operator (?:): syntax and examplesLanguage · · C++17
  46. C++ typedef: what it does and when to write using insteadLanguage · · C++17
  47. C++ while loop (and do-while): syntax and examplesLanguage · · C++17
  48. Destructor in C++: what it is and when it runsLanguage · · C++17
  49. Pointers in C++: what they are and how they workLanguage · · C++17
  50. Polymorphism in C++: one call, many behaviorsLanguage · · C++17
  51. printf in C++: format specifiers, std::string and snprintfStandard Library · · C++17
  52. C++ sqrt: square root with std::sqrt and cmathStandard Library · · C++17
  53. std::accumulate in C++: sum a vector, with examplesStandard Library · · C++17
  54. std::array in C++: how to declare and use oneStandard Library · · C++17
  55. std::atomic in C++: what it guarantees and when to use itConcurrency · · C++20
  56. C++ bitset: std::bitset explained with examplesStandard Library · · C++17
  57. Condition variable in C++: std::condition_variable explainedConcurrency · · C++17
  58. std::deque in C++: what it is and when to use itStandard Library · · C++17
  59. C++ std::find: search a vector, array or stringStandard Library · · C++17
  60. std::forward in C++: perfect forwarding explainedTemplates · · C++17
  61. C++ priority queue: std::priority_queue explainedStandard Library · · C++17
  62. C++ set (std::set): sorted unique values explainedStandard Library · · C++17
  63. C++ sort (std::sort): sort a vector or arrayStandard Library · · C++17
  64. std::swap in C++: how to swap two values, with examplesStandard Library · · C++17
  65. std::tie, std::pair and std::tuple: unpacking and comparingStandard Library · · C++17
  66. std::transform in C++: apply a function to every elementStandard Library · · C++17
  67. Struct in C++: declare, initialize and use oneLanguage · · C++17
  68. C++ substring: how to use substr(), with examplesStandard Library · · C++17
  69. volatile keyword in C++: what it does and does not doLanguage · · C++17
  70. Can a C++ destructor throw? What happens since C++11Language · · C++20
  71. C++ expression templates explained with a C++20 exampleTemplates · · C++20
  72. C++ generators: co_yield and std::generatorConcurrency · · C++23
  73. C++ int to string: to_string, format or to_chars, not itoaStandard Library · · C++17
  74. Strings as C++ template parameters with C++20 fixed_stringTemplates · · C++20
  75. C++ string to int: std::stoi or std::from_chars, not atoiStandard Library · · C++17
  76. C++ templates: how to write function and class templatesTemplates · · C++17
  77. C++ virtual functions: override, pure virtual and the trapsLanguage · · C++11
  78. C++20 concepts: how to write and use themStandards · · C++20
  79. C++ generic lambdas, template lambdas and function objectsTemplates · · C++20
  80. How to write comparators for std::sort and std::mapStandard Library · · C++20
  81. C++ move semantics: what std::move and && really doLanguage · · C++20
  82. C++ pass by value or const reference: the rule since C++17Performance · · C++20
  83. Rule of zero: the special members C++ writes for youLanguage · · C++20
  84. std::expected in C++23: return a value or an errorStandard Library · · C++23
  85. std::function in C++: what it costs, what to use insteadTemplates · · C++17
  86. C++ map: std::map find, insert, erase and iterateStandard Library · · C++17
  87. std::mutex in C++: how to lock it, and which lock to useConcurrency · · C++17
  88. std::optional in C++: how to use it and when not toStandard Library · · C++17
  89. std::println in C++23: print without std::cout or printfStandard Library · · C++23
  90. std::span in C++20: pass a view, not a pointer and a sizeStandard Library · · C++20
  91. std::thread and std::jthread: start, join and stop a threadConcurrency · · C++20
  92. std::variant in C++: std::visit, std::get and the trapsStandard Library · · C++17
  93. std::vector in C++: size, capacity, erase and reallocationPerformance · · C++17
  94. C++ try catch: how to throw and catch exceptionsLanguage · · C++17
  95. using namespace std: what it does and what to write insteadLanguage · · C++17
  96. When to mark a move constructor noexcept in C++Performance · · C++20