Table of Contents for
Expert C++ Programming

Version ebook / Retour

Cover image for bash Cookbook, 2nd Edition Expert C++ Programming by Jacek Galowicz Published by Packt Publishing, 2018
  1. Expert C++ Programming
  2. Title Page - Courses
  3. Copyright and Credits - Courses
  4. Expert C++ Programming
  5. Packt Upsell - Courses
  6. Why subscribe?
  7. PacktPub.com
  8. Table of Contents
  9. Preface
  10. Who this learning path is for
  11. What this learning path covers
  12. To get the most out of this learning path
  13. Download the example code files
  14. Conventions used
  15. Get in touch
  16. Reviews
  17. Mastering C++ Programming
  18. Introduction to C++17 Standard Template Library
  19. The Standard Template Library architecture
  20. Algorithms
  21. Iterators
  22. Containers
  23. Functors
  24. Sequence containers
  25. Array
  26. Code walkthrough
  27. Commonly used APIs in an array
  28. Vector 
  29. Code walkthrough
  30. Commonly used vector APIs
  31. Code walkthrough
  32. Pitfalls of a vector
  33. List 
  34. Commonly used APIs in a list
  35. Forward list
  36. Code walkthrough
  37. Commonly used APIs in a forward_list container
  38. Deque
  39. Commonly used APIs in a deque
  40. Associative containers
  41. Set
  42. Code walkthrough
  43. Commonly used APIs in a set
  44. Map
  45. Code walkthrough
  46. Commonly used APIs in a map
  47. Multiset
  48. Multimap
  49. Unordered sets
  50. Unordered maps
  51. Unordered multisets
  52. Unordered multimaps
  53. Container adapters
  54. Stack
  55. Commonly used APIs in a stack
  56. Queue
  57. Commonly used APIs in a queue
  58. Priority queue
  59. Commonly used APIs in a priority queue
  60. Summary
  61. Template Programming
  62. Generic programming
  63. Function templates
  64. Code walkthrough
  65. Overloading function templates
  66. Code walkthrough
  67. Class template
  68. Code walkthrough
  69. Explicit class specializations
  70. Code walkthrough
  71. Partial template specialization
  72. Summary
  73. Smart Pointers
  74. Memory management
  75. Issues with raw pointers
  76. Smart pointers
  77. auto_ptr
  78. Code walkthrough - Part 1
  79. Code walkthrough - Part 2
  80. unique_ptr
  81. Code walkthrough
  82. shared_ptr
  83. Code walkthrough
  84. weak_ptr
  85. Circular dependency
  86. Summary
  87. Developing GUI Applications in C++
  88. Qt 
  89. Installing Qt 5.7.0 in Ubuntu 16.04
  90. Qt Core
  91. Writing our first Qt console application
  92. Qt Widgets
  93. Writing our first Qt GUI application
  94. Layouts
  95. Writing a GUI application with a horizontal layout
  96. Writing a GUI application with a vertical layout
  97. Writing a GUI application with a box layout
  98. Writing a GUI application with a grid layout
  99. Signals and slots
  100. Using stacked layout in Qt applications
  101. Writing a simple math application combining multiple layouts
  102. Summary
  103. Test-Driven Development
  104. TDD
  105. Common myths and questions around TDD
  106. Does it take more efforts for a developer to write a unit test? 
  107. Is code coverage metrics good or bad?
  108. Does TDD work for complex legacy projects? 
  109. Is TDD even applicable for embedded or products that involve hardware?
  110. Unit testing frameworks for C++
  111. Google test framework
  112. Installing Google test framework on Ubuntu
  113. How to build google test and mock together as one single static library without installing?
  114. Writing our first test case using the Google test framework
  115. Using Google test framework in Visual Studio IDE
  116. TDD in action
  117. Testing a piece of legacy code that has dependency
  118. Summary
  119. Behavior-Driven Development
  120. Behavior-driven development
  121. TDD versus BDD
  122. C++ BDD frameworks
  123. The Gherkin language
  124. Installing cucumber-cpp in Ubuntu
  125. Installing the cucumber-cpp framework prerequisite software
  126. Building and executing the test cases
  127. Feature file
  128. Spoken languages supported by Gherkin
  129. The recommended cucumber-cpp project folder structure
  130. Writing our first Cucumber test case
  131. Integrating our project in cucumber-cpp CMakeLists.txt
  132. Executing our test case
  133. Dry running your cucumber test cases
  134. BDD - a test-first development approach
  135. Let's build and run our BDD test case
  136. It's testing time!
  137. Summary
  138. Code Smells and Clean Code Practices
  139. Code refactoring
  140. Code smell
  141. What is agile?
  142. SOLID design principle
  143. Single responsibility principle
  144. Open closed principle
  145. Liskov substitution principle
  146. Interface segregation
  147. Dependency inversion
  148. Code smell
  149. Comment smell
  150. Long method
  151. Long parameter list
  152. Duplicate code
  153. Conditional complexity
  154. Large class
  155. Dead code
  156. Primitive obsession
  157. Data class
  158. Feature envy
  159. Summary
  160. Mastering C++ Multithreading
  161. Revisiting Multithreading
  162. Getting started
  163. The multithreaded application
  164. Makefile
  165. Other applications
  166. Summary
  167. Multithreading Implementation on the Processor and OS
  168. Introduction to POSIX pthreads
  169. Creating threads with the pthreads library
  170. How to compile and run
  171. Does C++ support threads natively?
  172. Defining processes and threads
  173. Tasks in x86 (32-bit and 64-bit)
  174. Process state in ARM
  175. The stack
  176. Defining multithreading
  177. Flynn's taxonomy
  178. Symmetric versus asymmetric multiprocessing
  179. Loosely and tightly coupled multiprocessing
  180. Combining multiprocessing with multithreading
  181. Multithreading types
  182. Temporal multithreading
  183. Simultaneous multithreading (SMT)
  184. Schedulers
  185. Tracing the demo application
  186. Mutual exclusion implementations
  187. Hardware
  188. Software
  189. Concurrency
  190. How to compile and run
  191. Asynchronous message passing using the concurrency support library
  192. How to compile and run
  193. Concurrency tasks
  194. How to compile and run
  195. Using tasks with a thread support library
  196. How to compile and run
  197. Binding the thread procedure and its input to packaged_task 
  198. How to compile and run
  199. Exception handling with the concurrency library
  200. How to compile and run
  201. What did you learn?
  202. Summary
  203. C++ Multithreading APIs
  204. API overview
  205. POSIX threads
  206. Windows support
  207. PThreads thread management
  208. Mutexes
  209. Condition variables
  210. Synchronization
  211. Semaphores
  212. Thread local storage (TLC)
  213. Windows threads
  214. Thread management
  215. Advanced management
  216. Synchronization
  217. Condition variables
  218. Thread local storage
  219. Boost
  220. Thread class
  221. Thread pool
  222. Thread local storage (TLS)
  223. Synchronization
  224. C++ threads
  225. Putting it together
  226. Summary
  227. Thread Synchronization and Communication
  228. Safety first
  229. The scheduler
  230. High-level view
  231. Implementation
  232. Request class
  233. Worker class
  234. Dispatcher
  235. Makefile
  236. Output
  237. Sharing data
  238. Using r/w-locks
  239. Using shared pointers
  240. Summary
  241. Native C++ Threads and Primitives
  242. The STL threading API
  243. Boost.Thread API
  244. The 2011 standard
  245. C++14
  246. Thread class
  247. Basic use
  248. Passing parameters
  249. Return value
  250. Moving threads
  251. Thread ID
  252. Sleeping
  253. Yield
  254. Detach
  255. Swap
  256. Mutex
  257. Basic use
  258. Non-blocking locking
  259. Timed mutex
  260. Lock guard
  261. Unique lock
  262. Scoped lock
  263. Recursive mutex
  264. Recursive timed mutex
  265. Shared mutex
  266. Shared timed mutex
  267. Condition variable
  268. Condition_variable_any
  269. Notify all at thread exit
  270. Future
  271. Promise
  272. Shared future
  273. Packaged_task
  274. Async
  275. Launch policy
  276. Atomics
  277. Summary
  278. Debugging Multithreaded Code
  279. When to start debugging
  280. The humble debugger
  281. GDB
  282. Debugging multithreaded code
  283. Breakpoints
  284. Back traces
  285. Dynamic analysis tools
  286. Limitations
  287. Alternatives
  288. Memcheck
  289. Basic use
  290. Error types
  291. Illegal read / illegal write errors
  292. Use of uninitialized values
  293. Uninitialized or unaddressable system call values
  294. Illegal frees
  295. Mismatched deallocation
  296. Overlapping source and destination
  297. Fishy argument values
  298. Memory leak detection
  299. Helgrind
  300. Basic use
  301. Misuse of the pthreads API
  302. Lock order problems
  303. Data races
  304. DRD
  305. Basic use
  306. Features
  307. C++11 threads support
  308. Summary
  309. Best Practices
  310. Proper multithreading
  311. Wrongful expectations - deadlocks
  312. Being careless - data races
  313. Mutexes aren't magic
  314. Locks are fancy mutexes
  315. Threads versus the future
  316. Static order of initialization
  317. Summary
  318. Atomic Operations - Working with the Hardware
  319. Atomic operations
  320. Visual C++
  321. GCC
  322. Memory order
  323. Other compilers
  324. C++11 atomics
  325. Example
  326. Non-class functions
  327. Example
  328. Atomic flag
  329. Memory order
  330. Relaxed ordering
  331. Release-acquire ordering
  332. Release-consume ordering
  333. Sequentially-consistent ordering
  334. Volatile keyword
  335. Summary
  336. Multithreading with Distributed Computing
  337. Distributed computing, in a nutshell
  338. MPI
  339. Implementations
  340. Using MPI
  341. Compiling MPI applications
  342. The cluster hardware
  343. Installing Open MPI
  344. Linux and BSDs
  345. Windows
  346. Distributing jobs across nodes
  347. Setting up an MPI node
  348. Creating the MPI host file
  349. Running the job
  350. Using a cluster scheduler
  351. MPI communication
  352. MPI data types
  353. Custom types
  354. Basic communication
  355. Advanced communication
  356. Broadcasting
  357. Scattering and gathering
  358. MPI versus threads
  359. Potential issues
  360. Summary
  361. Multithreading with GPGPU
  362. The GPGPU processing model
  363. Implementations
  364. OpenCL
  365. Common OpenCL applications
  366. OpenCL versions
  367. OpenCL 1.0
  368. OpenCL 1.1
  369. OpenCL 1.2
  370. OpenCL 2.0
  371. OpenCL 2.1
  372. OpenCL 2.2
  373. Setting up a development environment
  374. Linux
  375. Windows
  376. OS X/MacOS
  377. A basic OpenCL application
  378. GPU memory management
  379. GPGPU and multithreading
  380. Latency
  381. Potential issues
  382. Debugging GPGPU applications
  383. Summary
  384. C++17 STL Cookbook
  385. The New C++17 Features
  386. Introduction
  387. Using structured bindings to unpack bundled return values
  388. How to do it...
  389. How it works...
  390. There's more...
  391. Limiting variable scopes to if and switch statements
  392. How to do it...
  393. How it works...
  394. There's more...
  395. Profiting from the new bracket initializer rules
  396. How to do it...
  397. How it works...
  398. Letting the constructor automatically deduce the resulting template class type
  399. How to do it...
  400. How it works...
  401. There's more...
  402. Simplifying compile time decisions with constexpr-if
  403. How to do it...
  404. How it works...
  405. There's more...
  406. Enabling header-only libraries with inline variables
  407. How it's done...
  408. How it works...
  409. There's more...
  410. Implementing handy helper functions with fold expressions
  411. How to do it...
  412. How it works...
  413. There's more...
  414. Match ranges against individual items
  415. Check if multiple insertions into a set are successful
  416. Check if all the parameters are within a certain range
  417. Pushing multiple items into a vector
  418. STL Containers
  419. Using the erase-remove idiom on std::vector
  420. How to do it...
  421. How it works...
  422. There's more...
  423. Deleting items from an unsorted std::vector in O(1) time
  424. How to do it...
  425. How it works...
  426. Accessing std::vector instances the fast or the safe way
  427. How to do it...
  428. How it works...
  429. There's more...
  430. Keeping std::vector instances sorted
  431. How to do it...
  432. How it works...
  433. There's more...
  434. Inserting items efficiently and conditionally into std::map
  435. How to do it...
  436. How it works...
  437. There's more...
  438. Knowing the new insertion hint semantics of std::map::insert
  439. How to do it...
  440. How it works...
  441. There's more...
  442. Efficiently modifying the keys of std::map items
  443. How to do it...
  444. How it works...
  445. There's more...
  446. Using std::unordered_map with custom types
  447. How to do it...
  448. How it works...
  449. Filtering duplicates from user input and printing them in alphabetical order with std::set
  450. How to do it...
  451. How it works...
  452. std::istream_iterator
  453. std::inserter
  454. Putting it together
  455. Implementing a simple RPN calculator with std::stack
  456. How to do it...
  457. How it works...
  458. Stack handling
  459. Distinguishing operands from operations from user input
  460. Selecting and applying the right mathematical operation
  461. There's more...
  462. Implementing a word frequency counter with std::map
  463. How to do it...
  464. How it works...
  465. Implement a writing style helper tool for finding very long sentences in text with std::multimap
  466. How to do it...
  467. How it works...
  468.  There's more...
  469. Implementing a personal to-do list using std::priority_queue
  470. How to do it...
  471. How it works...
  472. Iterators
  473. Introduction
  474. Iterator categories
  475. Input iterator
  476. Forward iterator
  477. Bidirectional iterator
  478. Random access iterator
  479. Contiguous iterator
  480. Output iterator
  481. Mutable iterator
  482. Building your own iterable range
  483. How to do it...
  484. How it works...
  485. Making your own iterators compatible with STL iterator categories
  486. How to do it...
  487. How it works...
  488. There's more...
  489. Using iterator adapters to fill generic data structures
  490. How to do it...
  491. How it works...
  492. std::back_insert_iterator
  493. std::front_insert_iterator
  494. std::insert_iterator
  495. std::istream_iterator
  496. std::ostream_iterator
  497. Implementing algorithms in terms of iterators
  498. How to do it...
  499. There's more...
  500. Iterating the other way around using reverse iterator adapters
  501. How to do it...
  502. How it works...
  503. Terminating iterations over ranges with iterator sentinels
  504. How to do it...
  505. Automatically checking iterator code with checked iterators
  506. How to do it...
  507. How it works...
  508. There's more...
  509. Building your own zip iterator adapter
  510. How to do it...
  511. There's more...
  512. Ranges library
  513. Lambda Expressions
  514. Introduction
  515. Defining functions on the run using lambda expressions
  516. How to do it...
  517. How it works...
  518. Capture list
  519. mutable (optional)
  520. constexpr (optional)
  521. exception attr (optional)
  522. return type (optional)
  523. Adding polymorphy by wrapping lambdas into std::function
  524. How to do it...
  525. How it works...
  526. Composing functions by concatenation
  527. How to do it...
  528. How it works...
  529. Creating complex predicates with logical conjunction
  530. How to do it...
  531. There's more...
  532. Calling multiple functions with the same input
  533. How to do it...
  534. How it works...
  535. Implementing transform_if using std::accumulate and lambdas
  536. How to do it...
  537. How it works...
  538. Generating cartesian product pairs of any input at compile time
  539. How to do it...
  540. How it works...
  541. STL Algorithm Basics
  542. Introduction
  543. Copying items from containers to other containers
  544. How to do it...
  545. How it works...
  546. Sorting containers
  547. How to do it...
  548. How it works...
  549. Removing specific items from containers
  550. How to do it...
  551. How it works...
  552. Transforming the contents of containers
  553. How to do it...
  554. How it works...
  555. Finding items in ordered and unordered vectors
  556. How to do it...
  557. How it works...
  558. Limiting the values of a vector to a specific numeric range with std::clamp
  559. How to do it...
  560. How it works...
  561. Locating patterns in strings with std::search and choosing the optimal implementation
  562. How to do it...
  563. How it works...
  564. Sampling large vectors
  565. How to do it...
  566. How it works...
  567. Generating permutations of input sequences
  568. How to do it...
  569. How it works...
  570. Implementing a dictionary merging tool
  571. How to do it...
  572. How it works...
  573. Advanced Use of STL Algorithms
  574. Introduction
  575. Implementing a trie class using STL algorithms
  576. How to do it...
  577. How it works...
  578. Implementing a search input suggestion generator with tries
  579. How to do it...
  580. How it works...
  581. There's more...
  582. Implementing the Fourier transform formula with STL numeric algorithms
  583. How to do it...
  584. How it works...
  585. Calculating the error sum of two vectors
  586. How to do it...
  587. How it works...
  588. Implementing an ASCII Mandelbrot renderer
  589. How to do it...
  590. How it works...
  591. Building our own algorithm - split
  592. How to do it...
  593. How it works...
  594. There's more...
  595. Composing useful algorithms from standard algorithms - gather
  596. How to do it...
  597. How it works...
  598. Removing consecutive whitespace between words
  599. How to do it...
  600. How it works...
  601. Compressing and decompressing strings
  602. How to do it...
  603. How it works...
  604. There's more...
  605. Strings, Stream Classes, and Regular Expressions
  606. Introduction
  607. Creating, concatenating, and transforming strings
  608. How to do it...
  609. How it works...
  610. Trimming whitespace from the beginning and end of strings
  611. How to do it...
  612. How it works...
  613. Getting the comfort of std::string without the cost of constructing std::string objects
  614. How to do it...
  615. How it works...
  616. Reading values from user input
  617. How to do it...
  618. How it works...
  619. Counting all words in a file
  620. How to do it...
  621. How it works...
  622. Formatting your output with I/O stream manipulators
  623. How to do it...
  624. How it works...
  625. Initializing complex objects from file input
  626. How to do it...
  627. How it works...
  628. Filling containers from std::istream iterators
  629. How to do it...
  630. How it works...
  631. Generic printing with std::ostream iterators
  632. How to do it...
  633. How it works...
  634. Redirecting output to files for specific code sections
  635. How to do it...
  636. How it works...
  637. Creating custom string classes by inheriting from std::char_traits
  638. How to do it...
  639. How it works...
  640. Tokenizing input with the regular expression library
  641. How to do it...
  642. How it works...
  643. Comfortably pretty printing numbers differently per context on the fly
  644. How to do it...
  645. Catching readable exceptions from std::iostream errors
  646. How to do it...
  647. How it works...
  648. Utility Classes
  649. Introduction
  650. Converting between different time units using std::ratio
  651. How to do it...
  652. How it works...
  653. There's more...
  654. Converting between absolute and relative times with std::chrono
  655. How to do it...
  656. How it works...
  657. Safely signalizing failure with std::optional
  658. How to do it...
  659. How it works...
  660. Applying functions on tuples
  661. How to do it...
  662. How it works...
  663. Quickly composing data structures with std::tuple
  664. How to do it...
  665. How it works...
  666. operator<< for tuples
  667. The zip function for tuples
  668. Replacing void* with std::any for more type safety
  669. How to do it...
  670. How it works...
  671. Storing different types with std::variant
  672. How to do it...
  673. How it works...
  674. Automatically handling resources with std::unique_ptr
  675. How to do it...
  676. How it works...
  677. Automatically handling shared heap memory with std::shared_ptr
  678. How to do it...
  679. How it works...
  680. There's more...
  681. Dealing with weak pointers to shared objects
  682. How to do it...
  683. How it works...
  684. Simplifying resource handling of legacy APIs with smart pointers
  685. How to do it...
  686. How it works...
  687. Sharing different member values of the same object
  688. How to do it...
  689. How it works...
  690. Generating random numbers and choosing the right random number engine
  691. How to do it...
  692. How it works...
  693. Generating random numbers and letting the STL shape specific distributions
  694. How to do it...
  695. How it works...
  696. Parallelism and Concurrency
  697. Introduction
  698. Automatically parallelizing code that uses standard algorithms
  699. How to do it...
  700. How it works...
  701. Which STL algorithms can we parallelize this way?
  702. How do those execution policies work?
  703. What does vectorization mean?
  704. Putting a program to sleep for specific amounts of time
  705. How to do it...
  706. How it works...
  707. Starting and stopping threads
  708. How to do it...
  709. How it works...
  710. Performing exception safe shared locking with std::unique_lock and std::shared_lock
  711. How to do it...
  712. How it works...
  713. Mutex classes
  714. Lock classes
  715. Avoiding deadlocks with std::scoped_lock
  716. How to do it...
  717. How it works...
  718. Synchronizing concurrent std::cout use
  719. How to do it...
  720. How it works...
  721. Safely postponing initialization with std::call_once
  722. How to do it...
  723. How it works...
  724. Pushing the execution of tasks into the background using std::async
  725. How to do it...
  726. How it works...
  727. There's more...
  728. Implementing the producer/consumer idiom with std::condition_variable
  729. How to do it...
  730. How it works...
  731. Implementing the multiple producers/consumers idiom with std::condition_variable
  732. How to do it...
  733. How it works...
  734. Parallelizing the ASCII Mandelbrot renderer using std::async
  735. How to do it...
  736. How it works...
  737. Implementing a tiny automatic parallelization library with std::future
  738. How to do it...
  739. How it works...
  740. Filesystem
  741. Introduction
  742. Implementing a path normalizer
  743. How to do it...
  744. How it works...
  745. There's more...
  746. Getting canonical file paths from relative paths
  747. How to do it...
  748. How it works...
  749. Listing all files in directories
  750. How to do it...
  751. How it works...
  752. Implementing a grep-like text search tool
  753. How to do it...
  754. How it works...
  755. There's more...
  756. Implementing an automatic file renamer
  757. How to do it...
  758. Implementing a disk usage counter
  759. How to do it...
  760. How it works...
  761. Calculating statistics about file types
  762. How to do it...
  763. Implementing a tool that reduces folder size by substituting duplicates with symlinks
  764. How to do it...
  765. How it works...
  766. There's more...
  767. Bibliography
Expert C++ Programming