Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Chapter 1. The New C++17 FeaturesIn this chapter, we will cover thefollowing recipes:Using structured bindings to unpack bundled return valuesLimiting variable scopes to if and switch statementsProfiting from the new bracket initializer rulesLetting the constructor automatically deduce the resulting template class typeSimplifying compile-time decisions with constexpr-ifEnabling header-only libraries with inline variablesImplementing handy helper functions with fold expressions
Chapter 1. The New C++17 Features
Chapter 2. STL ContainersWe will cover the following recipes in this chapter:Using the erase-remove idiom on std::vectorDeleting items from an unsorted std::vector in O(1) timeAccessing std::vector instances the fast or the safe wayKeeping std::vector instances sortedInserting items efficiently and conditionally into std::mapKnowing the new insertion hint semantics of std::map::insertEfficiently modifying the keys of std::map itemsUsing std::unordered_map with custom typesFiltering duplicates from user input and printing them in alphabetical order with std::setImplementing a simple RPN calculator with std::stackImplementing a word frequency counter with std::mapImplementing a writing style helper tool for finding very long sentences in texts with std::setImplementing a personal to-do list using std::priority_queue
Chapter 2. STL Containers
Chapter 3. IteratorsWe cover the following recipes in this chapter:Building your own iterable rangeMaking your own iterators compatible with STL iterator categoriesUsing iterator wrappers to fill generic data structuresImplementing algorithms in terms of iteratorsIterating the other way around using reverse iterator adaptersTerminating iterations over ranges with iterator sentinelsAutomatically checking iterator code with checked iteratorsBuilding your own zip iterator adapter
Chapter 3. Iterators
Chapter 4. Lambda ExpressionsWe will cover the following recipes in this chapter:Defining functions on the run using lambda expressionsAdding polymorphy by wrapping lambdas into std::functionComposing functions by concatenationCreating complex predicates with logical conjunctionCalling multiple functions with the same inputImplementing transform_if using std::accumulate and lambdasGenerating cartesian product pairs of any input at compile time
Chapter 4. Lambda Expressions
Chapter 5. STL Algorithm BasicsWe will cover the following recipes in this chapter:Copying items from containers to other containersSorting containersRemoving specific items from containersTransforming the contents of containersFinding items in ordered and unordered vectorsLimiting the values of a vector to a specific numeric range with std::clampLocating patterns in strings with std::search and choosing the optimal implementationSampling large vectorsGenerating permutations of input sequencesImplementing a dictionary merging tool
Chapter 5. STL Algorithm Basics
Chapter 6. Advanced Use of STL AlgorithmsWe will cover the following recipes in this chapter:Implementing a trie class using STL algorithmsImplementing a search input suggestion generator with triesImplementing the Fourier transform formula with STL numeric algorithmsCalculating the error sum of two vectorsImplementing an ASCII Mandelbrot rendererBuilding our own algorithm - splitComposing useful algorithms from standard algorithms - gatherRemoving consecutive whitespace between wordsCompressing and decompressing strings
Chapter 6. Advanced Use of STL Algorithms
Chapter 7. Strings, Stream Classes, and Regular ExpressionsWe will cover the following recipes in this chapter:Creating, concatenating, and transforming stringsTrimming whitespace from the beginning and end of stringsGetting the comfort of std::string without the cost of constructing std::string objectsReading values from user inputCounting all words in a fileFormatting your output with I/O stream manipulatorsInitializing complex objects from file inputFilling containers from std::istream iteratorsGeneric printing with std::ostream iteratorsRedirect output to files for specific code sectionsCreating custom string classes by inheriting from std::char_traitsTokenizing input with the regular expression libraryComfortably pretty printing numbers differently per context on the flyCatching readable exceptions from std::iostream errors
Chapter 7. Strings, Stream Classes, and Regular Expressions
Chapter 8. Utility ClassesIn this chapter, we will cover the following recipes:Converting between different time units using std::ratioConverting between absolute and relative times with std::chronoSafely signalizing failure with std::optionalApplying functions on tuplesQuickly composing data structures with std::tupleReplacing void* with std::any for more type safetyStoring different types with std::variantAutomatically handling resources with std::unique_ptrAutomatically handling shared heap memory with std::shared_ptrDealing with weak pointers to shared objectsSimplifying resource handling of legacy APIs with smart pointersSharing different member values of the same objectGenerating random numbers and choosing the right random number engineGenerating random numbers and letting the STL shape specific distributions
Chapter 8. Utility Classes
Chapter 9. Parallelism and ConcurrencyIn this chapter, we will cover the following recipes:Automatically parallelizing code that uses standard algorithmsPutting a program to sleep for specific amounts of timeStarting and stopping threadsPerforming exception-safe shared locking with std::unique_lock and std::shared_lockAvoiding deadlocks with std::scoped_lockSynchronizing concurrent std::cout useSafely postponing initialization with std::call_oncePushing the execution of tasks into the background using std::asyncImplementing the producer/consumer idiom with std::condition_variableImplementing the multiple producers/consumers idiom with std::condition_variableParallelizing the ASCII Mandelbrot renderer using std::asyncImplementing a tiny automatic parallelization library with std::future
Chapter 9. Parallelism and Concurrency
Chapter 10. FilesystemIn this chapter, we will cover the following recipes:Implementing a path normalizerGetting canonical file paths from relative pathsListing all files in directoriesImplementing a grep-like text search toolImplementing an automatic file renamerImplementing a disk usage counterCalculating statistics about file typesImplementing a tool that reduces folder size by substituting duplicates with symlinks
Chapter 10. Filesystem
← Prev
Back
Next →
← Prev
Back
Next →