Learning Boost C++ Libraries
eBook - ePub

Learning Boost C++ Libraries

Arindam Mukherjee

Condividi libro
  1. 558 pagine
  2. English
  3. ePUB (disponibile sull'app)
  4. Disponibile su iOS e Android
eBook - ePub

Learning Boost C++ Libraries

Arindam Mukherjee

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Informazioni sul libro

About This Book

  • Provide support to your programming tasks and data structures with Boost libraries
  • Write efficient and maintainable code to enhance the performance of your applications
  • A step by step guide, filled with real-world examples to give you the perfect start with Boost libraries

Who This Book Is For

If you are a C++ programmer who has never used Boost libraries before, this book will get you up-to-speed with using them. Whether you are developing new C++ software or maintaining existing code written using Boost libraries, this hands-on introduction will help you decide on the right library and techniques to solve your practical programming problems.

What You Will Learn

  • Write efficient and maintainable code using expressive interfaces from Boost libraries
  • Leverage a variety of flexible, practical, and highly efficient containers and algorithms beyond STL
  • Solve common programming problems by applying a wide array of utility libraries
  • Design and write portable multithreaded code that is easy to read and maintain
  • Craft highly scalable and efficient TCP and UDP servers
  • Build and deploy Boost libraries across a variety of popular platforms
  • Use C++11 functionality and emulate C++11 language features in C++03 code

In Detail

Filled with dozens of working code examples that illustrate the use of over 40 popular Boost libraries, this book takes you on a tour of Boost, helping you to independently build the libraries from source and use them in your own code.

The first half of the book focuses on basic programming interfaces including generic containers and algorithms, strings, resource management, exception safety, and a miscellany of programming utilities that make everyday programming chores easy. Following a short interlude that introduces template metaprogramming and functional programming, the later chapters are devoted to systems programming interfaces, focusing on directory handling, I/O, concurrency, and network programming

Domande frequenti

Come faccio ad annullare l'abbonamento?
È semplicissimo: basta accedere alla sezione Account nelle Impostazioni e cliccare su "Annulla abbonamento". Dopo la cancellazione, l'abbonamento rimarrà attivo per il periodo rimanente già pagato. Per maggiori informazioni, clicca qui
È possibile scaricare libri? Se sì, come?
Al momento è possibile scaricare tramite l'app tutti i nostri libri ePub mobile-friendly. Anche la maggior parte dei nostri PDF è scaricabile e stiamo lavorando per rendere disponibile quanto prima il download di tutti gli altri file. Per maggiori informazioni, clicca qui
Che differenza c'è tra i piani?
Entrambi i piani ti danno accesso illimitato alla libreria e a tutte le funzionalità di Perlego. Le uniche differenze sono il prezzo e il periodo di abbonamento: con il piano annuale risparmierai circa il 30% rispetto a 12 rate con quello mensile.
Cos'è Perlego?
Perlego è un servizio di abbonamento a testi accademici, che ti permette di accedere a un'intera libreria online a un prezzo inferiore rispetto a quello che pagheresti per acquistare un singolo libro al mese. Con oltre 1 milione di testi suddivisi in più di 1.000 categorie, troverai sicuramente ciò che fa per te! Per maggiori informazioni, clicca qui.
Perlego supporta la sintesi vocale?
Cerca l'icona Sintesi vocale nel prossimo libro che leggerai per verificare se è possibile riprodurre l'audio. Questo strumento permette di leggere il testo a voce alta, evidenziandolo man mano che la lettura procede. Puoi aumentare o diminuire la velocità della sintesi vocale, oppure sospendere la riproduzione. Per maggiori informazioni, clicca qui.
Learning Boost C++ Libraries è disponibile online in formato PDF/ePub?
Sì, puoi accedere a Learning Boost C++ Libraries di Arindam Mukherjee in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Informatica e Programmazione in C++. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

Anno
2015
ISBN
9781783551224
Edizione
1
Argomento
Informatica

Learning Boost C++ Libraries


Table of Contents

Learning Boost C++ Libraries
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Introducing Boost
How it all started
What is Boost?
Getting started with Boost libraries
Necessary software
Linux toolchain
Windows toolchain
Obtaining and building Boost libraries
Planning your Boost sandbox
Library naming conventions
Library name components
Library name layouts
Versioned layout
System layout
Tagged layout
Installing a Boost binary distribution
Installing on Windows
Installing on Linux
Building and installing the Boost libraries from source
Optional packages
Building the Boost libraries on Linux
Building the Boost libraries on Windows
Using Boost libraries in your projects
Linking against Boost libraries on Linux
Linking against Boost libraries on Windows
Building the code listings in this book
CMake
Code examples
Self-test questions
Summary
2. The First Brush with Boost's Utilities
Simple data structures
Boost.Optional
Accessing values stored in boost::optional
get_value_or
Boost.Optional versus pointers
Boost.Tuple
Creating tuples
Accessing tuple elements
Comparing tuples
Writing generic code using tuples
Working with heterogeneous values
Boost.Variant
Accessing values in a variant
Compile-time visitation
Generic visitors
Applying visitors to variants in a container
Defining recursive variants
The JSON format
Representing JSON content with recursive variants
Visiting recursive variants
Boost.Any
Boost.Conversion
lexical_cast
Handling command-line arguments
Designing command-line options
The diff command – a case study
Using Boost.Program_Options
Parsing positional parameters
Multiple option values
Other utilities and compile-time checks
BOOST_CURRENT_FUNCTION
Boost.Swap
Compile-time asserts
Diagnostics using preprocessor macros
Self-test questions
Summary
References
3. Memory Management and Exception Safety
Dynamic memory allocation and exception safety
Exception safety and RAII
Smart pointers
Unique ownership semantics
boost::scoped_ptr
Uses of scoped_ptr
Creating exception-safe scopes
Transferring object ownership across functions
As a class member
boost::scoped_array
std::unique_ptr
Ownership transfer using unique_ptr
Wrapping arrays in unique_ptr
make_unique in C++14
Shared ownership semantics
boost::shared_ptr and std::shared_ptr
Uses of shared_ptr
As a class member
Storing dynamically-allocated objects in Standard Library containers
Nonowning aliases – boost::weak_ptr and std::weak_ptr
A shared_ptr critique – make_shared and enable_shared_from_this
Intrusive smart pointers – boost::intrusive_ptr
Using intrusive_ptr
shared_array
Managing non-memory resources using smart pointers
Self-test questions
Summary
References
4. Working with Strings
Text processing with Boost String Algorithms library
Using Boost String Algorithms
Find algorithms
find_first
find_all
find_token
iter_find
find
find_head and find_tail
Other algorithms for testing string properties
Case-conversion and trimming algorithms
Case-conversion algorithms
Trimming algorithms
The replace and erase algorithms
The split and join algorithms
Splitting text using the Boost Tokenizer library
Tokenizing based on separators
Tokenizing records with fields containing metacharacters
Tokenizing records with fixed-length fields
Writing your own tokenizer functions
Regular expressions using Boost.Regex
Regular expression syntax
Atoms
Quantifiers
Character classes
Anchors
Sub-expressions
Disjunctions
Using Boost.Regex to parse regular expressions
Matching text
Searching text
Tokenizing text using regex
Replacing text
Self-test questions
Summary
5. Effective Data Structures beyond STL
Boost Container library
Move-awareness and in-place construction
Nonstandard containers
Flat associative containers
slist
Splicing
stable_vector
static_vector
Fast lookups using Boost Unordered containers
Containers for dynamically-allocated objects
Ownership semantics of pointer containers
Null pointers in pointer containers
Expressive initialization and assignment using Boost.Assign
Assigning lists of values to containers
Initializing containers with lists of values
Initializing pointer containers and assigning values
Iteration patterns using Boost.Iterator
Smart iteration using Boost.Iterator
Filter Iterator
Transform Iterator
Function Output Iterator
Creating conforming iterators for custom classes
Self-test questions
Summary
References
6. Bimap and Multi-index Containers
Containers for multi-criteria lookups
Boost Multi-index containers
Index types
Range lookups using lambda
Insertions and updates
Boost Bimap
Collection types
More ways to use bimaps
Tagged access
Projections
Self-test questions
Summary
References
7. Higher Order and Compile-time Programming
Higher order programming with Boost
Function objects
Lambdas – unnamed function literals
Lambda captures
Delegates and closures
Partial function application
Compile-time programming with Boost
Basic compile-time control flow using templates
Branching
Recursion
Boost Type Traits
SFINAE and enable_if / disable_if
The Boost Metaprogramming Library (MPL)
Metafunctions
Using MPL metafunctions
Domain Specific Embedded Languages
Lazy evaluation
Expression templates
Boost Phoenix
Boost Spirit Parser Framework
Using Spirit Qi
Predefined parsers
The parsing API
Parser operators and expressions
Parsing directives
Semantic actions
Rules
Parsing timestamps
Self-test questions
Summary
References
8. Date and Time Libraries
Date and time calculations with Boost Date Time
Dates from the Gregorian calendar
Creating date objects
Handling date durations
Date periods
Posix time
Constructing time points and durations
Resolution
Time periods
Time iterator
Using Chrono to measure time
Durations
Duration arithmetic
Clocks and time points
Measuring program performance using Boost Timer
cpu_timer
auto_cpu_timer
Self-test questions
Summary
References
9. Files, Directories, and IOStreams
Managing files and directories with Boost Filesystem
Manipulating paths
Printing paths
Constructing paths
Breaking paths into components
Traversing directories
Querying filesystem entries
Performing operations on files
Creating directories
Creating symbolic links
Copying files
Moving and deleting files
Path-aware fstreams
Extensible I/O with Boost IOStreams
Architecture of Boost IOStreams
Using devices
Devices for file I/O
Devices for reading and writing to memory
Using filters
Basic filters
Filters for compression and decompression
Composing filters
Pipelining
Branchin...

Indice dei contenuti