Boost C++ Application Development Cookbook (PDF)

Boost C++ Application Development Cookbook
Antony Polukhin
Release at: 2013
Pages: 348
1st Edition
File Size: 4 MB
File Type: pdf
Language: English

Description of Boost C++ Application Development Cookbook

Boost C++ application development cookbook written by Antony Polukhin is a great book for C++ programming studies available in (PDF) free download. This Boost C++ Application Development Cookbook book Boost is a collection of C++ libraries. Reviewed each library by professional programmers before being accepted to Boost. Using many compilers, libraries are tested on multiple platforms and the C++ standard library implementations. While using Boost, you can be sure that you are using one of the most portable, fast, and reliable solutions that are distributed under a license suitable for commercial and open-source projects. Many parts of Boost applications have been included in C++ 11, and even more, parts are going to be included in the next standard of C++. You will find C++11-specific notes in each recipe of this Boost C++ Application Development Cookbook book.

Now that we know some of the basic Boost types for applications, the time is known as some data-converting functions. We'll see how to convert user-defined strings and number types to each other, how to safely cast polymorphic types, and how to write small and large parsers right inside the C++ source files.

Content of Boost C++ Application Development Cookbook

Chapter One: Starting to Write Your Application  7
Introduction  7
Getting configuration options  8
Storing any value in a container/variable  13
Storing multiple chosen types in a container/variable  16
Using the safe way to work with a container that stores multiple chosen types 18
Returning a flag or value where there is no value  22
Returning an array from a function  25
Combining multiple values into one  28
Reordering the parameters of function  30
Binding a function parameter value  34
Using the C++11 move emulation  37
Making a non-copyable class  40
Making a non-copyable but movable class  42
Chapter Two: Converting Data  47
Introduction  47
Converting strings to numbers  48
Converting numbers to strings  51
Converting numbers to numbers  53
Converting user-defined types to/from strings  56
Casting polymorphic objects  59
Parsing simple input  61
Parsing input  66
Chapter Three: Managing Resources  71
Introduction  71
Pointers managing to classes that do not leave scope  72
Pointers reference counting to classes used across methods  74
Pointers managing to arrays that do not leave scope  77
Reference counting pointers to arrays used across methods  79
Any functional objects storing in a variable  82
Passing a function pointer is a variable  85
Passing C++ Eleven lambda functions in a variable  86
Containers of pointers  88
Doing something at scope exit  91
Initializing the base class by a member of the derived class  93
Chapter Four: Compile-time Tricks  97
Introduction  97
Checking sizes at compile time  98
Enabling the usage of templated functions for integral types  102
Templated functions disabling usage for real types  106
Creating a type from number  108
Implementing a type trait  111
An optimal operator selecting for a template parameter  113
Getting of expression in C++03 type  116
Chapter Five: Multithreading  121
Introduction  121
Creating an execution thread  122
Syncing access to a common resource  126
Fast access to a common resource using atomics  131
Creating a work_queue class  134
Multiple-readers-single-writer lock  138
Creating variables that are unique per thread  141
Interrupting a thread  144
Manipulating a group of threads  146
Chapter Six: Manipulating Tasks  149
Introduction  149
Registering a task for processing an arbitrary datatype  150
Processing timer and making timers events as tasks  154
Network communication as a task  157
Accepting incoming connections  164
Executing different tasks in parallel  169
Conveyor tasks processing  171
Making a nonblocking barrier  176
Storing a making an exception a task from it  181
The processing system and getting signals as tasks  185
Chapter Seven: Manipulating Strings  189
Introduction  189
Changing cases and case-insensitive comparison  189
Matching strings using regular expressions  192
Replacing and searching strings using regular expressions  196
Formatting strings using safe printf-like functions  199
Replacing and erasing strings  201
Representing a string with two iterators  203
Using a reference to string type  206
Chapter Eight: Metaprogramming  211
Introduction  211
Using type "vector of types"  212
Manipulating a vector of types  217
Getting a function's result type at compile time  222
Making a higher-order metafunction  225
Evaluating metafunctions lazily  227
Converting all the tuple elements to strings  230
Splitting tuples  234
Chapter Nine: Containers  239
Introduction  239
Comparing strings in an ultra-fast manner  240
Using an unordered set and map  244
Making a map, where value is also a key  248
Using multi-index containers  252
Getting the benefits of single-linked list and memory pool  258
Using flat associative containers  263
Chapter Ten: Gathering Platform and Compiler Information  267
Introduction  267
Detecting int128 support  268
Detecting RTTI support  270
Speeding up compilation using C++11 extern templates  272
Writing metafunctions using simpler methods  274
Reducing code size and increasing performance of user-defined
types (UDTs) in C++11  276
The portable way to export and import functions and classes  279
Detecting the Boost version and getting latest features  282
Chapter Eleven: Working with the System  285
Introduction  285
Listing files in a directory  286
Erasing and creating files and directories  288
Passing data quickly from one process to another  291
Syncing interprocess communications  294
Using pointers in shared memory  297
The fastest way to read files  300
Coroutines – saving the state and postponing the execution  302
Chapter Twelve: Scratching the Tip of the Iceberg  307
Introduction  307
Working with graphs  308
Visualizing graphs  312
Using a true random number generator  315
Using portable math functions  317
Writing test cases  319
Combining multiple test cases in one test module  321
Manipulating images  323
Index  329

Similar Books