Download Complete C Crash Course A Fast Paced Introduction Josh Lospinoso PDF for All Chapters
Download Complete C Crash Course A Fast Paced Introduction Josh Lospinoso PDF for All Chapters
com
https://textbookfull.com/product/c-crash-course-a-fast-
paced-introduction-josh-lospinoso/
OR CLICK BUTTON
DOWNLOAD NOW
https://textbookfull.com/product/python-crash-course-a-hands-on-
project-based-introduction-to-programming-2nd-edition-eric-matthes/
textboxfull.com
https://textbookfull.com/product/puppet-5-essentials-a-fast-paced-
guide-to-automating-your-infrastructure-martin-alfke/
textboxfull.com
https://textbookfull.com/product/mysql-crash-course-2nd-edition-forta/
textboxfull.com
https://textbookfull.com/product/electrochemistry-crash-course-for-
engineers-slobodan-petrovic/
textboxfull.com
Excel Crash Course For Engineers Eklas Hossain
https://textbookfull.com/product/excel-crash-course-for-engineers-
eklas-hossain/
textboxfull.com
https://textbookfull.com/product/sign-of-evil-a-fast-paced-thriller-
di-sara-ramsey-book-11-1st-edition-m-a-comley-comley/
textboxfull.com
https://textbookfull.com/product/ap-chemistry-crash-course-2nd-
edition-adrian-dingle/
textboxfull.com
https://textbookfull.com/product/javaserver-faces-introduction-by-
example-juneau-josh/
textboxfull.com
https://textbookfull.com/product/paramedic-crash-course-with-online-
practice-test-1st-edition-christopher-coughlin-ph-d/
textboxfull.com
C++ CRASH COURSE
A Fast-Paced Introduction
by Josh Lospinoso
San Francisco
C++ CRASH COURSE. Copyright © 2019 by Josh Lospinoso.
All rights reserved. No part of this work may be reproduced or transmitted in any
form or by any means, electronic or mechanical, including photocopying, recording, or
by any information storage or retrieval system, without the prior written permission of
the copyright owner and the publisher.
ISBN-10: 1-59327-888-8
ISBN-13: 978-1-59327-888-5
No Starch Press and the No Starch Press logo are registered trademarks of No Starch
Press, Inc. Other product and company names mentioned herein may be the
trademarks of their respective owners. Rather than use a trademark symbol with every
occurrence of a trademarked name, we are using the names only in an editorial fashion
and to the benefit of the trademark owner, with no intention of infringement of the
trademark.
The information in this book is distributed on an “As Is” basis, without warranty.
While every precaution has been taken in the preparation of this work, neither the
author nor No Starch Press, Inc. shall have any liability to any person or entity with
respect to any loss or damage caused or alleged to be caused directly or indirectly by
the information contained in it.
#include <algorithm>
#include <iostream>
#include <string>
int main() {
auto i{ 0x01B99644 };
std::string x{ " DFaeeillnor" };
while (i--) std::next_permutation(x.begin(), x.end());
std::cout << x;
}
About the Author
Josh Lospinoso, PhD, is an entrepreneur who served 15 years in the US
Army. As a cyber officer, Josh wrote dozens of infosec tools and taught
C++ to junior developers. He has spoken at a wide range of conferences,
published over 20 peer-reviewed articles, is a Rhodes Scholar, and holds
a patent. In 2012, he co-founded a successfully acquired security
company. He keeps a blog and is an active contributor to open source
software.
About the Technical Reviewer
Kyle Willmon is a systems developer with 12 years of C++ experience.
He has worked in the information security community for 7 years
utilizing C++, Python, and Go across a variety of projects. Kyle
currently works as a developer for Sony’s Global Threat Emulation
Team.
BRIEF CONTENTS
Foreword by Peter Bindels
Acknowledgments
Introduction
An Overture to C Programmers
ACKNOWLEDGMENTS
INTRODUCTION
About This Book
Who Should Read This Book?
What’s in This Book?
Part I: The C++ Core Language
Part II: C++ Libraries and Frameworks
AN OVERTURE TO C PROGRAMMERS
Upgrading to Super C
Function Overloading
References
auto Initialization
Namespaces and Implicit typedef of struct, union, and enum
Intermingling C and C++ Object Files
C++ Themes
Expressing Ideas Concisely and Reusing Code
The C++ Standard Library
Lambdas
Generic Programming with Templates
Class Invariants and Resource Management
Move Semantics
Relax and Enjoy Your Shoes
2
TYPES
Fundamental Types
Integer Types
Floating-Point Types
Character Types
Boolean Types
The std::byte Type
The size_t Type
void
Arrays
Array Initialization
Accessing Array Elements
A Nickel Tour of for Loops
C-Style Strings
User-Defined Types
Enumeration Types
Plain-Old-Data Classes
Unions
Fully Featured C++ Classes
Methods
Access Controls
Constructors
Initialization
The Destructor
Summary
3
REFERENCE TYPES
Pointers
Addressing Variables
Dereferencing Pointers
The Member-of-Pointer Operator
Pointers and Arrays
Pointers Are Dangerous
void Pointers and std::byte Pointers
nullptr and Boolean Expressions
References
Usage of Pointers and References
Forward-Linked Lists: The Canonical Pointer-Based Data
Structure
Employing References
this Pointers
const Correctness
const Member Variables
Member Initializer Lists
auto Type Deduction
Initialization with auto
auto and Reference Types
auto and Code Refactorings
Summary
4
THE OBJECT LIFE CYCLE
An Object’s Storage Duration
Allocation, Deallocation, and Lifetime
Memory Management
Automatic Storage Duration
Static Storage Duration
Thread-Local Storage Duration
Dynamic Storage Duration
Tracing the Object Life Cycle
Exceptions
The throw Keyword
Using try-catch Blocks
stdlib Exception Classes
Handling Exceptions
User-Defined Exceptions
The noexcept Keyword
Call Stacks and Exceptions
A SimpleString Class
Appending and Printing
Using SimpleString
Composing a SimpleString
Call Stack Unwinding
Exceptions and Performance
Alternatives to Exceptions
Copy Semantics
Copy Constructors
Copy Assignment
Default Copy
Copy Guidelines
Move Semantics
Copying Can Be Wasteful
Value Categories
lvalue and rvalue References
The std::move Function
Move Construction
Move Assignment
The Final Product
Compiler-Generated Methods
Summary
5
RUNTIME POLYMORPHISM
Polymorphism
A Motivating Example
Adding New Loggers
Interfaces
Object Composition and Implementation Inheritance
Defining Interfaces
Base Class Inheritance
Member Inheritance
virtual Methods
Pure-Virtual Classes and Virtual Destructors
Implementing Interfaces
Using Interfaces
Updating the Bank Logger
Constructor Injection
Property Injection
Choosing Constructor or Property Injection
Summary
6
COMPILE-TIME POLYMORPHISM
Templates
Declaring Templates
Template Class Definitions
Template Function Definitions
Instantiating Templates
Named Conversion Functions
const_cast
static_cast
reinterpret_cast
narrow_cast
mean: A Template Function Example
Genericizing mean
Template Type Deduction
SimpleUniquePointer: A Template Class Example
Type Checking in Templates
Concepts
Defining a Concept
Type Traits
Requirements
Building Concepts from Requires Expressions
Using Concepts
Ad Hoc Requires Expressions
static_assert: The Preconcepts Stopgap
Non-Type Template Parameters
Variadic Templates
Advanced Template Topics
Template Specialization
Name Binding
Type Function
Template Metaprogramming
Template Source Code Organization
Polymorphism at Runtime vs. Compile Time
Summary
7
EXPRESSIONS
Operators
Logical Operators
Arithmetic Operators
Assignment Operators
Increment and Decrement Operators
Comparison Operators
Member Access Operators
Ternary Conditional Operator
The Comma Operator
Operator Overloading
Overloading Operator new
Operator Precedence and Associativity
Evaluation Order
User-Defined Literals
Type Conversions
Implicit Type Conversions
Explicit Type Conversion
C-Style Casts
User-Defined Type Conversions
Constant Expressions
A Colorful Example
The Case for constexpr
Volatile Expressions
Summary
8
STATEMENTS
Expression Statements
Compound Statements
Declaration Statements
Functions
Namespaces
Type Aliasing
Structured Bindings
Attributes
Selection Statements
if Statements
switch Statements
Iteration Statements
while Loops
do-while Loops
for Loops
Ranged-Based for Loops
Jump Statements
break Statements
continue Statements
goto Statements
Summary
9
FUNCTIONS
Function Declarations
Prefix Modifiers
Suffix Modifiers
auto Return Types
auto and Function Templates
Overload Resolution
Variadic Functions
Variadic Templates
Programming with Parameter Packs
Revisiting the sum Function
Fold Expressions
Function Pointers
Declaring a Function Pointer
Type Aliases and Function Pointers
The Function-Call Operator
A Counting Example
Lambda Expressions
Usage
Lambda Parameters and Bodies
Default Arguments
Generic Lambdas
Lambda Return Types
Lambda Captures
constexpr Lambda Expressions
std::function
Declaring a Function
An Extended Example
The main Function and the Command Line
The Three main Overloads
Exploring Program Parameters
A More Involved Example
Exit Status
Summary
10
TESTING
Unit Tests
Integration Tests
Acceptance Tests
Performance Tests
An Extended Example: Taking a Brake
Implementing AutoBrake
Test-Driven Development
Adding a Service-Bus Interface
Unit-Testing and Mocking Frameworks
The Catch Unit-Testing Framework
Google Test
Boost Test
Summary: Testing Frameworks
Mocking Frameworks
Google Mock
HippoMocks
A Note on Other Mocking Options: FakeIt and Trompeloeil
Summary
11
SMART POINTERS
Smart Pointers
Smart Pointer Ownership
Scoped Pointers
Constructing
Bring in the Oath Breakers
Implicit bool Conversion Based on Ownership
RAII Wrapper
Pointer Semantics
Comparison with nullptr
Swapping
Resetting and Replacing a scoped_ptr
Non-transferability
boost::scoped_array
A Partial List of Supported Operations
Unique Pointers
Constructing
Supported Operations
Transferable, Exclusive Ownership
Unique Arrays
Deleters
Custom Deleters and System Programming
A Partial List of Supported Operations
Shared Pointers
Constructing
Specifying an Allocator
Supported Operations
Transferable, Non-Exclusive Ownership
Shared Arrays
Deleters
A Partial List of Supported Operations
Weak Pointers
Constructing
Obtaining Temporary Ownership
Advanced Patterns
Supported Operations
Intrusive Pointers
Summary of Smart Pointer Options
Allocators
Summary
12
UTILITIES
Data Structures
tribool
optional
pair
tuple
any
variant
Date and Time
Boost DateTime
Chrono
Numerics
Numeric Functions
Complex Numbers
Mathematical Constants
Random Numbers
Numeric Limits
Boost Numeric Conversion
Compile-Time Rational Arithmetic
Summary
13
CONTAINERS
Sequence Containers
Arrays
Vectors
Niche Sequential Containers
Associative Containers
Sets
Unordered Sets
Maps
Niche Associative Containers
Graphs and Property Trees
The Boost Graph Library
Boost Property Trees
Initializer Lists
Summary
14
ITERATORS
Iterator Categories
Output Iterators
Input Iterators
Forward Iterators
Bidirectional Iterators
Random-Access Iterators
Contiguous Iterators
Mutable Iterators
Auxiliary Iterator Functions
std::advance
std::next and std::prev
std::distance
std::iter_swap
Additional Iterator Adapters
Move Iterator Adapters
Reverse Iterator Adapters
Summary
15
STRINGS
std::string
Constructing
String Storage and Small String Optimizations
Element and Iterator Access
String Comparisons
Manipulating Elements
Search
Numeric Conversions
String View
Constructing
Supported string_view Operations
Ownership, Usage, and Efficiency
Regular Expressions
Patterns
basic_regex
Algorithms
Boost String Algorithms
Boost Range
Predicates
Classifiers
Finders
Modifying Algorithms
Splitting and Joining
Searching
Boost Tokenizer
Localizations
Summary
16
STREAMS
Streams
Stream Classes
Stream State
Buffering and Flushing
Manipulators
User-Defined Types
String Streams
File Streams
Stream Buffers
Random Access
Summary
17
FILESYSTEMS
Filesystem Concepts
std::filesystem::path
Constructing Paths
Decomposing Paths
Modifying Paths
Summary of Filesystem Path Methods
Files and Directories
Error Handling
Path-Composing Functions
Inspecting File Types
Inspecting Files and Directories
Manipulating Files and Directories
Directory Iterators
Constructing
Directory Entries
Recursive Directory Iteration
fstream Interoperation
Summary
18
ALGORITHMS
Algorithmic Complexity
Execution Policies
Non-Modifying Sequence Operations
all_of
any_of
none_of
for_each
for_each_n
find, find_if, and find_if_not
find_end
find_first
adjacent_find
count
mismatch
equal
is_permutation
search
search_n
Mutating Sequence Operations
copy
copy_n
copy_backward
move
move_backward
swap_ranges
transform
replace
fill
generate
remove
unique
reverse
sample
shuffle
Sorting and Related Operations
sort
stable_sort
partial_sort
is_sorted
nth_element
Binary Search
lower_bound
upper_bound
equal_range
binary_search
Partitioning Algorithms
is_partitioned
partition
partition_copy
stable_partition
Merging Algorithms
merge
Extreme-Value Algorithms
min and max
min_element and max_element
clamp
Numeric Operations
Useful Operators
iota
accumulate
reduce
inner_product
adjacent_difference
partial_sum
Other Algorithms
Boost Algorithm
19
CONCURRENCY AND PARALLELISM
Concurrent Programming
Asynchronous Tasks
Sharing and Coordinating
Low-Level Concurrency Facilities
Parallel Algorithms
An Example: Parallel sort
Parallel Algorithms Are Not Magic
Summary
20
NETWORK PROGRAMMING WITH BOOST ASIO
The Boost Asio Programming Model
Network Programming with Asio
The Internet Protocol Suite
Hostname Resolution
Connecting
Buffers
Reading and Writing Data with Buffers
The Hypertext Transfer Protocol (HTTP)
Implementing a Simple Boost Asio HTTP Client
Asynchronous Reading and Writing
Serving
Multithreading Boost Asio
Summary
21
WRITING APPLICATIONS
Program Support
Handling Program Termination and Cleanup
Communicating with the Environment
Managing Operating System Signals
Boost ProgramOptions
The Options Description
Parsing Options
Storing and Accessing Options
Putting It All Together
Special Topics in Compilation
Revisiting the Preprocessor
Compiler Optimization
Linking with C
Summary
INDEX
FOREWORD
“C++ is a complicated language.” This is a reputation C++ has earned
across a number of decades of use, and not always for the right reasons.
Often, this is used as a reason to disallow people from learning C++, or
as a reason why a different programming language would be better.
These arguments are hard to substantiate because the basic premise
they rely on is wrong: C++ is not a complicated language. The biggest
problem C++ has is its reputation, and the second biggest problem is the
lack of high-quality educational materials for learning it.
The language itself has evolved over the past four decades from C. It
started off as being a fork of C (with minor additions) and a pre-
compiler called Cfront, which compiles early C++ code to C that is then
to be processed with the C compiler. Hence the name Cfront—in front
of C. After a few years of progress and development, this proved to limit
the language too much and work was undertaken to create an actual
compiler. This compiler, written by Bjarne Stroustrup (the original
inventor of the language), could compile a C++ program stand-alone.
Other companies were also interested in continuing from basic C
support and made their own C++ compilers, mostly compatible with
either Cfront or the newer compiler.
This proved to be untenable because the language was unportable
and wildly incompatible between compilers. Not to mention the fact
that keeping all decisions and direction within the hands of a single
person is not the way to make a cross-company international standard—
there are standard procedures for that, and organizations that manage
them. C++ was thus moved to become an ISO standard belonging to the
International Standards Organization. After a number of years of
development, the first official C++ standard came out in 1998, and
people rejoiced.
They rejoiced for only a short while though, because while C++98
was a good definition, it had included a few new developments that
Random documents with unrelated
content Scribd suggests to you:
Turner having looked over the articles, pulled out the sliding shutter
which extends across the counter, so as to obscure the customer
from the view even of a person in the adjoining box, and having
taken this precaution, he spoke to me, in a very respectful manner,
to the following effect: “Sir, I hope you will excuse what I am going to
say; but having observed that you frequently pledge similar goods to
these at our shop, which are afterwards taken out by other persons, I
take for granted you are in the habit of selling the duplicates; it is not
my wish to be impertinently curious, but my reason for asking, is,
that if I am right in my conjecture, I conceive you might as well give
me the opportunity of purchasing them as a stranger. I am ready to
give you a fair price, as I have opportunities of disposing of such
goods in the way of trade, and without putting them in the window, or
exposing them at all. Or if you prefer selling them at once, I will offer
you the utmost farthing I can give, at a word, and save both you and
myself the trouble of a duplicate.” All this he uttered in a low but
earnest voice, and with every appearance of sincerity. Perceiving me
to hesitate, he added with increased emphasis, “Depend on it, Sir, I’ll
deal upon the square with you; I don’t mean to take the smallest
advantage, I assure you.” These last words determined me. I thought
it improbable that he could have any motive for deceiving me, and
knowing that many of the pawnbrokers in London are men of the
world, who, while they preserve outwardly a fair reputation, are at the
bottom arrant receivers of stolen goods, I supposed this man to be
one of them; I therefore answered that he was not mistaken in his
opinion; that I was myself in the habit of dealing in such goods, and
being sometimes pressed for money, I was then obliged to pledge or
sell a few articles, to relieve a temporary inconvenience; and that,
relying upon his promises of fair dealing, I had no objection, when
such was the case, to give him an opportunity of becoming a
purchaser. He thanked me for the favour, and desired I would set a
price upon the articles I had now brought. I did so, and he offered me
at once a sum equal to what I expected, though somewhat less than
I asked him. Having received the money agreed for, I departed, well
pleased with having formed so good a connexion. I only describe this
interview as explanatory of a circumstance I shall by and by have
occasion to relate.
Any body would suppose that I might have been satisfied with my
late success at Bilger and Son’s, and it will hardly be credited that I
should have the temerity to pay them a second visit, agreeably to the
promise I gave Mr. Bilger at parting: but, such was nevertheless the
fact. On the Monday following the Friday on which I robbed them,
having occasion for a little ready money to pay an instalment to my
tailor, with whom I kept a running account, I requested my wife to
take the diamond-ring I had kept for my own wear, and pledge it at
Turner’s for five guineas, while I myself went with her ring to another
shop, and borrowed three guineas on it. I conceived there could be
no danger attending this proceeding, as there was nothing
remarkable in either of the rings, and I had the fullest conviction that
the pawnbroker to whom I applied, was actually such a character as
from the conversation of Turner, I doubted not the latter to be:
besides, it was in my power at a minute’s warning to have redeemed
both, and I intended so to do in a few days. The next day (Tuesday,)
I determined to re-visit Mr. Bilger, against the advice both of my wife
and Bromley, who censured such a step as an act of downright
madness, which indeed it certainly was: but I was so infatuated as to
think it possible that as there was another party in the shop as well
as myself, the suspicion might have attached to her; or, that my
appearance and address would so far operate in my favour, as at
least to leave Bilger in doubt who to suspect: in which case, my
calling again exactly at the time I had promised, would certainly
remove every shadow of such doubt, and I might perhaps be
enabled to obtain one or more of the valuable watches Mr. Bilger had
shewn me. To make every thing secure I intended to take Bromley
with me, who could observe the reception I met with, and in the
event of my being detained on suspicion, I directed him to hasten to
my wife with the information, who was instantly to redeem the two
rings we had pledged, and then effectually conceal the whole of the
stolen articles beyond the reach of discovery; so that no property
being found on, or traced to me, I must inevitably have been
discharged. These precautions were certainly sufficient to prevent
any ill consequences, but still I shall ever condemn myself for so
rash an act. About six o’clock in the evening, myself and Bromley set
out on this ill-fated expedition. Arriving at Bilger’s, I entered with an
air of confidence, and finding the son only in the shop, I addressed
him with a good-natured smile in these words: “Well, Sir, you see I’m
punctual to my promise: is your father within?” He answered in the
affirmative, with a mixture of surprise and doubt in his countenance;
then stepping backwards, he called Mr. Bilger, saying in a significant
tone, “Father, here is the gentleman come about the diamond ring.”
Mr. Bilger then advancing, saluted me with a formal coldness, which
convinced me that I was suspected. However, it was then too late to
recede, so laying my hat upon the counter, and drawing a stool, I
said, with a familiar air, “Well, Mr. Bilger, I have called to give you
directions for making this ring, but I must beg that you will spare no
pains in the execution, as I repeat that the price will not be an object;
only tell me candidly at what time you will undertake to have it ready,
as I am going out of town in a few days.” He replied, that I might
depend on it by Saturday evening. “Very well,” said I, “that will be
time enough.” Mr. Bilger then desired his son to take down my
instructions, for which purpose the latter opened his day-book, and I
took from my pocket the card of draughts, in which I pointed out the
one I had determined on. Then describing minutely the various
particulars, the kind of shank, &c.; the young man wrote what he
thought necessary, appearing to pay the strictest attention to my
directions, and concluded with requesting my name and address. I
answered (what first came into my head, as my only object now was
to get decently clear of the shop,) “Mr. Deakin, 13, Curzon-street,
May-fair.” I next desired Mr. Bilger to shew me again his assortment
of lady’s watches, as I intended to purchase one when the ring was
completed; but, the old gentleman replied with evident
embarrassment, that he really had none in the house, but that his
son should wait upon me with a selection, when the ring was
finished! I answered carelessly, “that will do very well, Mr Bilger. I
hope, Sir, you will not fail to be punctual; let it be an elegant article,
and don’t neglect to send the watches. I shall now bid you good
evening.” Then buttoning my coat, &c., I advanced toward the door,
expecting every moment to be detained, or at least questioned about
the three diamond rings. Nothing of the sort, however, occurred. Mr.
Bilger attended me to the door with as much politeness, though not
quite the same warmth as at my first visit; and I was not at all sorry
when I found myself at a distance from the shop. My watchful friend
Bromley soon joined me, with the information that Bilger had stood
above a minute gazing after me before he closed the door, and that
he clearly perceived I had had a narrow escape. Having satisfied
myself by making the experiment, I now hastened home to relieve
the anxiety of my wife; and concluding I should neither see or hear
any more of Messrs. Bilger and Son, turned my attention to new
projects for “raising the wind.”
A few days afterwards, calling at Turner’s, the pawnbroker, to
dispose of some trifling articles, that person, after apologizing for the
liberty he was about to take, begged leave to ask if my “good lady”
had not pledged a diamond-ring with him a few days before, for five
guineas? Surprised at this question, I hesitated; on which he
continued, “I assure you, Sir, I have no impertinent motive for the
question, but a lady of my acquaintance having seen the article, is
very much in love with it; and, if it should be yours, and that you are
inclined hereafter to sell it, I should be happy to purchase it for her.
The lady who pledged it having frequently come to redeem articles
left by you, I concluded from thence that she was your wife.” As I
was willing to be upon my guard, I answered, that my wife had
indeed several rings, and it was possible he might be right in his
conjecture, but I was ignorant of her having pledged such an article;
that I would, however, make inquiry on the subject, and let him know
the next time I saw him. Having communicated this conversation to
my wife, she saw nothing extraordinary in it, as the ring was a very
elegant trinket, and would naturally excite the admiration of any lady.
The next day, I again called upon Turner, and told him that the ring
he mentioned was the property of my wife, but at present she had no
mind to part with it, and here the matter dropped.
Three or four days after this last interview, having been successful
at the theatres, and my purse being replenished, I determined to
redeem the ring pledged at Turner’s, and taking the duplicate with
me, I entered one of the private boxes as usual, from a back door in
Russell-court, and calling to the shopman, produced my ticket, and
desired to have the ring. The lad took the former out of my hand, and
laid it on a shelf; then proceeded with the business he was before
engaged in, without offering to attend to me. I thought this very odd,
and seeing Turner himself at the far end of the counter, writing
duplicates for some women, and pretending to be so much engaged
as not to notice me, though I was sensible he must, I began, as the
phrase is, to smell a rat. I then repeated my request to the boy, with
some impatience, and a louder voice, on which the latter went up to
his master, and I heard him whisper, “Sir, here’s the gentleman come
for the diamond-ring.” His master, without turning his head, or
looking off his book, (though he always used to pay the most eager
attention to me,) said something I could not hear; and the lad
approaching the box in which I stood, told me his master would be
glad if I would step round to the front door, (meaning the door of the
public shop, which opened into Brydges-street.) I was now more
than ever surprised, and convinced that mischief was intended me.
However, as in such cases, I was often too rash, and despised fear
as unbecoming an adventurer of my address and appearance, I
answered, “O by all means, my man, I’ll go round;” which I
immediately did; but on entering the shop, I was surprised to find that
Mr. Turner had vanished. I then said to the boy, with a smile of
gaiety, “Why, my good lad, I don’t see your master, now I’ve taken
the trouble to come here.” The boy replied, “Sir, my master will wait
upon you directly; he’s only gone backwards to speak to the
servant.” This was enough for me. I no longer doubted that he was
gone to send for an officer; and that it was, therefore, high time for
me to make sail while I was well. I, therefore, appeared for a moment
satisfied with the boy’s answer, but seeming suddenly to recollect
myself, I said to him, “My wife is at the door; I believe I may as well
ask her to step in,” Then immediately opening the door, which fell to
with a pulley, I quitted the shop and turning the corner, got into
Russell-court, through which I ran with all my speed, nor stopped till I
found myself at a considerable distance, and out of all danger. I then
walked home by a circuitous route, and related the adventure to my
wife, who was, of course, seriously alarmed, and joined with me in
reprobating the treachery of the pawnbroker, for whose perfidious
conduct, after the assurances he had given me, we were at a loss to
account.
CHAPTER VII.
Take a House in St. George’s Fields.—Stay at home for several Weeks.—At length
I venture out in quest of Money.—My imprudent Obstinacy in entering a
House of ill-repute against the Advice and Entreaties of my Wife.—I am taken
in custody, and carried to the Watch-house.—Distress of my Wife on the
Occasion.
About an hour after the officers had left me, they returned to the
watch-house, bringing in prisoner, a well-dressed gentleman in a
state of ebriety, accompanied by several of his friends, who it
seemed, had been taken in custody for riotous conduct at the
Haymarket theatre. As soon as they had given charge of this person,
and again withdrawn, the gentleman, whose friends had also taken
their leave, seated himself near the fire, and entered into
conversation with me on the subject of his apprehension. He
informed me, that having in the beginning of the evening had a
quarrel with another gentleman in the boxes, and their altercation
disturbing the audience, he had been taken into custody by these
officers as the aggressor; but that having apologized for his conduct,
and made his peace with his opponent, he had been liberated, and
the officers had suddenly quitted him; that about ten o’clock,
however, to his great surprise, the two rascally constables (as he
termed them,) had again apprehended him, under colour of the
original charge, and conveyed him to the watch-house; and that in
their way, they stated that they should have done so on his first
apprehension, but that they were suddenly sent for to the other end
of the town, for the express purpose of taking a notorious thief, of
whom they had received information! The gentleman here continued,
(little supposing he was speaking to the identical person,) “some d
⸺d house-breaker, or highwayman, I suppose. I don’t know who
the rascal was.” The reader may be sure I took no pains to inform
him; but commiserating his case, and condemning the base conduct
of the officers, we conversed together on indifferent subjects for
about an hour, and were then shewn to separate beds in the same
room, where we were locked up till morning. It now appeared evident
that I had been betrayed; but by whom, I am to this day ignorant;
sometimes suspecting the landlord; at others the young man I have
before mentioned; and sometimes, one of the company who sat at
table with me; as I was afterwards informed that the whole room
being much alarmed at my sudden apprehension, and the manner in
which it took place, some one remarked that I must certainly have
been villanously betrayed. Upon which this man (whose name was
Bill White, otherwise, Conky-beau,) immediately changed colour, and
said, “I hope nobody suspects me, I certainly did leave the room, but
it was only for a few minutes, in order to get a little tobacco at the
next shop.” At all events, there must have been much expedition
used, for I was not above half an hour in the house, and the distance
from thence to the Haymarket theatre is at least a mile. Indeed the
officers confessed to me afterwards, that I had been sold, (as the
phrase is,) but declared that no bribe should induce them to disclose
the party.
The ensuing morning, about ten, the officers conducted me to
Bow-street, where Mr. Justice Graham presided. On being put to the
bar, I observed Mr. Bilger, senior, and the perfidious pawnbroker, in
waiting; the former viewed me with attention, and seemed
immediately convinced of my identity, of which he informed the
magistrate. Having then stated the particulars of his charge, against
me, (which I need not here repeat,) the pawnbroker produced the
fatal ring, stating that he received it from a woman, whom I
afterwards acknowledged to be my wife; he also produced a pearl
and amethyst broach, set in gold, which he deposed to purchasing
from me among some other articles of the like nature. Mr. Bilger
swore that he believed the former to be his property, and the working
jeweller, who had supplied the three rings for my inspection, swore
positively to its being one of them; as to the broach, Mr. Bilger would
not positively swear, but fully believed it to be the one he lost. In this,
however, he was mistaken; for I have already stated that I kept that
broach for my own wear, and it was at this moment in pledge for one
pound in the Borough; but I had, a few days previous to my robbing
Mr. Bilger, purloined, among other trinkets, from a shop in the city, a
broach so exactly similar, that on comparing the two together, I was
in doubt which to retain; but the pearls, in Bilger’s, being rather
larger, I preferred the latter, and disposed of the other to Turner, as
he had truly said. When asked if I had any defence to offer, I merely
answered that I was not the person, having never seen Mr. Bilger or
his shop in my life. Mr. Graham observed, the case was so clear that
he should immediately commit me; but having understood that many
jewellers, &c., who had been robbed, were in attendance to identify
me, he inquired for them; the officers, however, stated that none
were present, except a shopman of Mr. Chandler in Leicester-fields,
who had been a considerable sufferer; but on this young man
viewing me, he declared I was not the person who had been at his
master’s shop; in which, by-the-by, he was egregiously mistaken.
The magistrate then committed me for trial, on Mr. Bilger’s charge;
and ordered that I should be brought up again on that day
se’ennight, (the 8th of February,) in order that the different
shopkeepers might have notice to attend. I was now conveyed to
Tothill-fields Bridewell, where I continued a week. My first object was
to establish a communication with my wife; but I was afraid of
suffering her to visit me, lest she might have been detained as an
accomplice. She, however, sent her sister to me daily, who brought
me every needful requisite for my use and comfort in the prison; and
among the rest, a change of apparel of a very different kind from that
in which I was apprehended. Having put on these clothes, I sent the
others back by the bearer; and the same day, a barber attending,
whom I had sent for to shave me, I requested him to cut off my
whiskers, and to crop my hair close. He did so, and I now cut so
different a figure, that no person could possibly identify me, unless
intimately acquainted with my features. Had I been enabled to take
these measures before I appeared at Bow-street, it is probable Mr.
Bilger would not have ventured to swear to me; but unfortunately
they were adopted too late to render me any essential service. When
the officers came to the prison, and saw the metamorphose I had
undergone, they were, however, highly enraged; charged the
turnkeys with gross neglect of duty, and want of vigilance in suffering
the means to be admitted, and threatened to represent the
circumstances to the magistrate. I laughed heartily at their chagrin,
and said all I could to heighten their vexation. On the day appointed,
I was brought up for re-examination; but it seemed the tradesmen
who were expected, had not thought it worth their while to attend, for
none made their appearance. Mr. Graham viewed me with evident
surprise, demanding why I was so differently dressed, and what I
had done with my whiskers[48]. I answered, that I wore whatever I
found most convenient to myself, and as to whiskers, I never had
any. His Worship stared at this assertion, and declared, that when he
first examined me, I had very large whiskers, and my hair dressed in
the fashionable mode. “However,” added he, “I see through your
design; but it has been executed too late, and this stratagem will not
now serve your turn.” I was then finally committed to Newgate, as
the Session was to commence on that day week (the 15th). My
unhappy wife was waiting the issue of my examination, in the
neighbourhood of the public office, and on learning the result, took
coach, and was at the door of Newgate as soon as myself. The
officers who escorted me having retired, both my wife and I were
very kindly received by the principal turnkey, who instantly
recognised us as Mr. and Mrs. Hardy, and expressed his concern at
my so soon becoming again an inmate of Newgate. He then ordered
me to have a light iron put on; and requesting to know what ward I
wished to go into, I chose the same I had before been a member of,
and to this room my wife accompanied me. After receiving the
compliments of such of the prisoners as were before my fellow-
lodgers, (among whom were the two brothers,) all of whom vied with
each other in contributing to our accommodation, we partook of
some tea; and having been a fortnight separated from my beloved
wife, I would not suffer her to quit me until the next morning.
I had now but a few days to prepare for my approaching trial; and
though I entertained no hopes of escaping conviction, I determined
to employ a counsel; and who so proper (thought I,) as my good
friend Mr. Knapp, who had so adroitly brought me off on a late
occasion. I, therefore, drew a brief, in which I dwelt strongly on some
particular points both of law and fact, and enclosed it, with the
customary fee, in a letter to that gentleman, reminding him of my
being his client in November session, and trusting he would do all in
his power to extricate me from my present embarrassment. Mr.
Knapp assured my wife that I might depend on his best exertions,
and I now waited with patience for the event. My affectionate partner
was unremitting in her attention to me, being never absent but when
she had occasion to look into our affairs at home and her sister
having undertaken the care of our house till my fate was determined,
she slept with me every night, as I had reason to fear I should soon
be removed to a place where I could not have this indulgence. It was
something singular that my poor friend Bromley, whom I had not
seen for two months before, was brought into Newgate the very day
after myself, being committed on a capital charge of house-breaking.
Being, however, unable to pay the fees required on the master’s
side, where I was situated, he was obliged to put up with the
common side, as it is termed; but the two yards being contiguous, I
had an opportunity of seeing him every day.
On Wednesday the 15th of February, 1809, I was taken down to
the sessions-house for trial; and four persons having been
successively tried for capital offences, all of whom were convicted, I
was next put to the bar, and stood indicted “for feloniously stealing,
on the 9th of December, &c., a double-rowed brilliant half-hoop ring,
value 16l. 16s.; a diamond ring for hair, value 9l. 9s.; a rose diamond
and ruby ring, with serpent-chased shank, value 6l. 6s.; and a pearl
and amethyst broach, value 2l. 2s., the goods of Matthias Bilger the
elder, and Matthias Bilger the younger, privately in their shop.” The
reader will observe that I was here indicted upon a certain act of
parliament, which makes it a capital offence to steal “goods, wares,
or merchandise, to the value of five shillings, privately in a shop.” My
indictment having been read over, I looked round for Mr. Knapp,
whom I expected to have found prepared with his brief; but not
observing him among the other counsellors, I inquired of the
turnkeys near me, who informed me that he was not in court. I then
requested of the judge that my trial might be deferred, on account of
the absence of my counsel. The court inquiring who was my counsel,
I answered, Mr. Knapp; upon which Mr. Gurney, another counsellor,
rising from his seat, said, “My lord, I am authorized to plead for Mr.
Knapp.” This satisfied me, not doubting but Mr. Gurney had my brief,
and would do all in his power; and I suffered the trial to proceed. The
indictment having been read as I have before described, to my no
small surprise, Mr. Raine, the counsellor who had been retained by
my prosecutors, rose, and proceeded to state the case to the jury; in
doing which, according to custom, he gave so clear a view of the
facts attending my offence, and so artfully and eloquently coloured
the whole, that I saw the jury had more than half convicted me
already, and would only listen to the subsequent evidence as a
requisite matter of form. The counsel concluded his statement with
this observation; “If, gentlemen, these facts are clearly proved to you
in evidence, (as I persuade myself they will be,) no doubt can remain
in your minds as to the verdict you will give.” He then proceeded to
examine the witnesses. Mr. Bilger, senior, deposed what the reader
is already in possession of, with these additions; that, a few minutes
after my quitting the shop, he missed the articles named in the
indictment; and that having, on my second visit, received my final
instructions for a ring, and the address I have before mentioned, he
went himself next day to Curzon-street, and found No. 13 to be an
empty house! Mr. Bilger having concluded, and Mr. Gurney not
offering to cross-examine him, conformable to the suggestions in my
brief, and as I fully expected he would, I was extremely surprised,
and was soon afterwards convinced that he had not received any
brief at all, or had any grounds to plead upon. I, therefore, requested
to ask Mr. Bilger a question, namely, “Why he did not apprehend me
on the Tuesday night, on which he swears I came the second time to
his shop, after having missed the property on the preceding Friday,
and suspected me for it?” Ans. “My lord, he had so much the
appearance of a gentleman that I thought I might be mistaken. He
was very differently dressed then from what he is now. He wore
whiskers, and an eye-glass, and was very nicely powdered[49]. My
son went to the door in order to get a constable, but he observed an
accomplice.” (What Mr. Bilger meant by this last assertion, or what
he would deduce from it, I have no idea.) The next evidence was that
of Turner the pawnbroker; and I had in my brief given such hints, that
I hoped Mr. Knapp would have effectually put this fellow out of
countenance, by making him confess that he had, at his own
request, repeatedly bought such things of me. But here Mr. Gurney
was still silent, and I saw that it would be useless for me to ask
Turner any questions. The working-jeweller was then called to
depose to the ring, which he did in the strongest terms. Mr. Gurney
barely asked him, if he could undertake to swear that he had not
made rings exactly similar for other shops? He replied, that he was
positive it was one of the three which he sent to Mr. Bilger on the 9th
of December. Next came the scoundrel who took me, George
Donaldson, a constable of St. Martin’s parish; who stated that
himself and Smith, one of the Bow-street patrole, from information
they had received, apprehended me at the Butchers’ Arms in Clare-
market, in company with a great many notorious thieves. The
evidence for the prosecution being now closed, Mr. Gurney inquired
of Mr. Bilger, senior, how many partners he had; who answered none
but his son. Then, what other persons were in the shop, (meaning
assistants,) besides his son and himself, when he lost his property?
Ans. “Only a porter, who was cleaning some plate at the further end
of the counter, at some distance from where the prisoner stood.” All
that Mr. Gurney, therefore, said or asked, any other person might
have said without reference to a brief; and having put these simple
questions, or at least put them in a simple and careless manner, Mr.
Gurney sat himself down. The last question, indeed, was of a most
important nature, and if properly handled, and enforced with
becoming spirit, would, I have little doubt, have rendered me the
most essential service. To explain my meaning, I must briefly
expound a point of law, with which nine readers out of ten may be
unacquainted. The Act, under which I was indicted, provides, or is
interpreted to mean, that where there are two or more persons
employed as shopmen, &c., it is not sufficient for one alone to attend
upon the prisoner’s trial; but that every one, if there was a dozen,
must personally appear, to swear that he or she did not see or
suspect the prisoner to commit the act of robbery; because the law
(always favourable to the culprit,) presumes, that if one person out of
the whole number is absent, that very person might possibly have
suspected the prisoner; and then such suspicion, however slight, if
confessed, proves that the robbery was not effected so privately as
to come within the meaning of the Act; consequently, there is an end
of the capital part of the charge, and the prisoner can only be
transported for seven years. The reader will see, in the next Chapter,
my reason for being thus particular in this explanation. The judge
now summed up the evidence, and what was most extraordinary, I
was not even called on for my defence; so much were the court
prejudiced against me, from the eloquent opening of the learned
counsel, the clear and decisive evidence of the witnesses; and,
perhaps, (above all,) from some little private intimation they had
received of my real character and past life. However, as I felt that no
defence I could make, was likely to prevent my conviction, I was not
much concerned on the occasion; and the jury after two minutes’
consideration returned the fatal verdict of “Guilty.” This verdict was
no sooner pronounced, than the villain Donaldson, standing up in the
witness-box, said, “My lord, I think it my duty to inform the court what
I know of the prisoner at the bar. I have been given to understand
that he is a very old offender, and that he has been but a few months
returned from Botany-Bay!” At this malicious address, there was a
general murmur of indignation throughout the whole court; and Mr.
Gurney (to do him justice,) rose with much warmth, saying, “Mr.
Donaldson, you ought to be ashamed of yourself for having made
such a disclosure; you acknowledge you only have this circumstance
from hearsay, and had you known it to be true, after the prisoner
being capitally convicted, it is most shameful and unmanly conduct
of you to mention it.” The malicious rascal was justly confounded at
this rebuff, and sneaked away amidst the execrations of the auditors.
After my conviction I was double-ironed, and detained in the dock
until the evening, my trial having occupied about two hours; and at
eight o’clock, I was escorted to the press-yard, and locked up in one
of the condemned cells. My poor wife remained in the ward of the
prison, to which I belonged, until she saw me pass by, and I had only
time to console her in a few words through the bars of the window,
and take leave of her till the morning.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
textbookfull.com