Boost C++ Application Development Cookbook - Second Edition

Learn to build applications faster and better by leveraging the real power of Boost and C++
Preview in Mapt

Boost C++ Application Development Cookbook - Second Edition

Antony Polukhin

Learn to build applications faster and better by leveraging the real power of Boost and C++
Mapt Subscription
FREE
$29.99/m after trial
eBook
$10.00
RRP $39.99
Save 74%
Print + eBook
$49.99
RRP $49.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$10.00
$49.99
$29.99 p/m after trial
RRP $39.99
RRP $49.99
Subscription
eBook
Print + eBook
Start 30 Day Trial

Frequently bought together


Boost C++ Application Development Cookbook - Second Edition Book Cover
Boost C++ Application Development Cookbook - Second Edition
$ 39.99
$ 10.00
Kubernetes Cookbook - Second Edition Book Cover
Kubernetes Cookbook - Second Edition
$ 35.99
$ 10.00
Buy 2 for $20.00
Save $55.98
Add to Cart

Book Details

ISBN 139781787282247
Paperback438 pages

Book Description

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

Chapter 1: 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
Chapter 2: 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
Chapter 3: Converting and Casting
Introduction
Converting strings to numbers
Converting numbers to strings
Converting numbers to numbers
Converting user-defined types to/from strings
Converting smart pointers
Casting polymorphic objects
Parsing simple input
Parsing complex input
Chapter 4: Compile-Time Tricks
Introduction
Checking sizes at compile time
Enabling function template usage for integral types
Disabling function template usage for real types
Creating a type from a number
Implementing a type trait
Selecting an optimal operator for a template parameter
Getting a type of expression in C++03
Chapter 5: 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
Chapter 6: 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
Chapter 7: 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
Chapter 8: Metaprogramming
Introduction
Using type vector of types
Manipulating a vector of types
Getting a function's result type at compile time
Making a higher-order metafunction
Evaluating metafunctions lazily
Converting all the tuple elements to strings
Splitting tuples
Manipulating heterogeneous containers in C++14
Chapter 9: 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
Chapter 10: 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
Chapter 11: 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
Chapter 12: Scratching the Tip of the Iceberg
Introduction
Working with graphs
Visualizing graphs
Using a true random number generator
Using portable math functions
Writing test cases
Combining multiple test cases in one test module
Manipulating images

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

Authors

Table of Contents

Chapter 1: 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
Chapter 2: 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
Chapter 3: Converting and Casting
Introduction
Converting strings to numbers
Converting numbers to strings
Converting numbers to numbers
Converting user-defined types to/from strings
Converting smart pointers
Casting polymorphic objects
Parsing simple input
Parsing complex input
Chapter 4: Compile-Time Tricks
Introduction
Checking sizes at compile time
Enabling function template usage for integral types
Disabling function template usage for real types
Creating a type from a number
Implementing a type trait
Selecting an optimal operator for a template parameter
Getting a type of expression in C++03
Chapter 5: 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
Chapter 6: 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
Chapter 7: 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
Chapter 8: Metaprogramming
Introduction
Using type vector of types
Manipulating a vector of types
Getting a function's result type at compile time
Making a higher-order metafunction
Evaluating metafunctions lazily
Converting all the tuple elements to strings
Splitting tuples
Manipulating heterogeneous containers in C++14
Chapter 9: 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
Chapter 10: 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
Chapter 11: 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
Chapter 12: Scratching the Tip of the Iceberg
Introduction
Working with graphs
Visualizing graphs
Using a true random number generator
Using portable math functions
Writing test cases
Combining multiple test cases in one test module
Manipulating images

Book Details

ISBN 139781787282247
Paperback438 pages
Read More

Read More Reviews

Recommended for You

Mastering Assembly Programming Book Cover
Mastering Assembly Programming
$ 35.99
$ 10.00
Computer Vision with Python 3 Book Cover
Computer Vision with Python 3
$ 35.99
$ 10.00
Beginning C# 7 Hands-On – The Core Language Book Cover
Beginning C# 7 Hands-On – The Core Language
$ 31.99
$ 10.00
Statistics for Machine Learning Book Cover
Statistics for Machine Learning
$ 39.99
$ 10.00
OpenGL – Build high performance graphics Book Cover
OpenGL – Build high performance graphics
$ 67.99
$ 10.00
Kubernetes Cookbook - Second Edition Book Cover
Kubernetes Cookbook - Second Edition
$ 35.99
$ 10.00