Book description
Learn to build applications faster and better by leveraging the real power of Boost and C++
About This Book
- Learn to use the Boost libraries to simplify your application development
- Learn to develop high quality, fast and portable applications
- Learn the relations between Boost and C++11/C++4/C++17
Who This Book Is For
This book is for developers looking to improve their knowledge of Boost and who would like to simplify their application development processes. Prior C++ knowledge and basic knowledge of the standard library is assumed.
What You Will Learn
- Get familiar with new data types for everyday use
- Use smart pointers to manage resources
- Get to grips with compile-time computations and assertions
- Use Boost libraries for multithreading
- Learn about parallel execution of different task
- Perform common string-related tasks using Boost libraries
- Split all the processes, computations, and interactions to tasks and process them independently
- Learn the basics of working with graphs, stacktracing, testing and interprocess communications
- Explore different helper macros used to detect compiler, platform and Boost features
In Detail
If you want to take advantage of the real power of Boost and C++ and avoid the confusion about which library to use in which situation, then this book is for you.
Beginning with the basics of Boost C++, you will move on to learn how the Boost libraries simplify application development. You will learn to convert data such as string to numbers, numbers to string, numbers to numbers and more. Managing resources will become a piece of cake. You’ll see what kind of work can be done at compile time and what Boost containers can do. You will learn everything for the development of high quality fast and portable applications. Write a program once and then you can use it on Linux, Windows, MacOS, Android operating systems. From manipulating images to graphs, directories, timers, files, networking – everyone will find an interesting topic.
Be sure that knowledge from this book won’t get outdated, as more and more Boost libraries become part of the C++ Standard.
Table of contents
- Preface
-
Starting to Write Your Application
- Introduction
- Getting configuration options
- Storing any value in a container/variable
- Storing multiple chosen types in a container/variable
- Using a safer way to work with a container that stores multiple chosen types
- Returning a value or flag where there is no value
- Returning an array from a function
- Combining multiple values into one
- Binding and reordering function parameters
- Getting a human-readable type name
- Using the C++11 move emulation
- Making a noncopyable class
- Making a noncopyable but movable class
- Using C++14 and C++11 algorithms
-
Managing Resources
- Introduction
- Managing local pointers to classes that do not leave scope
- Reference counting of pointers to classes used across functions
- Managing pointers to arrays that do not leave scope
- Reference counting of pointers to arrays used across functions
- Storing any functional objects in a variable
- Passing function pointer in a variable
- Passing C++11 lambda functions in a variable
- Containers of pointers
- Do it at scope exit!
- Initializing the base class by the member of the derived class
- Converting and Casting
- Compile-Time Tricks
-
Multithreading
- Introduction
- Creating a thread of execution
- Syncing access to a common resource
- Fast access to common resource using atomics
- Creating work_queue class
- Multiple-readers-single-writer lock
- Creating variables that are unique per thread
- Interrupting a thread
- Manipulating a group of threads
- Initializing a shared variable safely
- Locking multiple mutexes
-
Manipulating Tasks
- Introduction
- Registering a task for an arbitrary data type processing
- Making timers and processing timer events as tasks
- Network communication as a task
- Accepting incoming connections
- Executing different tasks in parallel
- Pipeline tasks processing
- Making a nonblocking barrier
- Storing an exception and making a task from it
- Getting and processing system signals as tasks
-
Manipulating Strings
- Introduction
- Changing cases and case-insensitive comparison
- Matching strings using regular expressions
- Searching and replacing strings using regular expressions
- Formatting strings using safe printf-like functions
- Replacing and erasing strings
- Representing a string with two iterators
- Using a reference to string type
- Metaprogramming
-
Containers
- Introduction
- Storing a few elements in a sequence container
- Storing at most N elements in the sequence container
- Comparing strings in an ultra-fast manner
- Using an unordered set and map
- Making a map, where value is also a key
- Using multi-index containers
- Getting benefits of a single linked list and memory pool
- Using flat associative containers
-
Gathering Platform and Compiler Information
- Introduction
- Detecting an OS and compiler
- Detecting int128 support
- Detecting and bypassing disabled RTTI
- Writing metafunctions using simpler methods
- Reducing code size and increasing performance of user-defined types (UDTs) in C++11
- The portable way to export and import functions and classes
- Detecting the Boost version and getting latest features
-
Working with the System
- Introduction
- Listing files in a directory
- Erasing and creating files and directories
- Writing and using plugins
- Getting backtrace – current call sequence
- Passing data quickly from one process to another
- Syncing interprocess communications
- Using pointers in a shared memory
- The fastest way to read files
- Coroutines - saving the state and postponing the execution
- Scratching the Tip of the Iceberg
Product information
- Title: Boost C++ Application Development Cookbook - Second Edition
- Author(s):
- Release date: September 2017
- Publisher(s): Packt Publishing
- ISBN: 9781787282247
You might also like
book
Modern C++: Efficient and Scalable Application Development
Create apps in C++ and leverage its latest features using modern programming techniques. Key Features Develop …
book
Learning Boost C++ Libraries
Solve practical programming problems using powerful, portable, and expressive libraries from Boost In Detail Filled with …
book
Optimized C++
In today’s fast and competitive world, a program’s performance is just as important to customers as …
book
Qt5 C++ GUI Programming Cookbook - Second Edition
Use Qt 5 to design and build functional, appealing, and user-friendly graphical user interfaces (GUIs) for …