Vector
A vector is an ordered, indexed sequence of elements, often numerical, represented as a mathematical quantity or a computational collection.
Learn C++ by Example
std::vector is the C++ standard library's dynamically sized contiguous sequence container.
- How it is used
- Uses vectors to store, traverse, display, query, and manipulate sequences while introducing ranges, algorithms, and lambdas.
- How deep it goes
- Explains initialization, traversal, insertion, nesting, const access, and selected move behavior, while deferring full iterator and value-category details.
- Examples
- Uses a one-element display, Pascal’s triangle, nested rows, and a console race containing runtime-sized collections.
- What you can do after
- Build it from scratch by creating vectors, filling and displaying them, generating nested data, and selecting copying or moving insertion.
100 C++ Mistakes and How to Avoid Them
A vector is a resizable sequence container whose elements are stored in contiguous memory.
- How it is used
- Replaces fixed arrays and unsafe varargs with dynamically sized, type-safe collections.
- How deep it goes
- Explains backing-array growth, insertion, reserve, type safety, and constructor tradeoffs, but not detailed reallocation mechanics.
- Examples
- Uses Person collections, computed capacity, and typed integer or floating-point sums as examples.
- What you can do after
- Apply it via std::vector to store meaningful objects, manage variable-length values, and avoid manual dynamic-array handling.
Read how 100 C++ Mistakes and How to Avoid Them explains vector →
Grokking Data Structures
A dynamic array is an array-like data structure whose storage can grow or shrink as elements are added or removed.
- How it is used
- Provides indexed storage for collections whose number of elements changes substantially.
- How deep it goes
- Explains fixed-size backing storage, doubling, quarter-full shrinking, and amortized costs rather than treating resizing as free.
- Examples
- Uses changing e-commerce orders and a stack push that fills its backing array.
- What you can do after
- Build it from scratch using a static array with doubling on growth and halving when quarter-full.
Code Like a Pro in Rust
- How it is used
- Uses `Vec` as Rust’s default resizable sequence for storing lists of values.
- How deep it goes
- Explains slice coercion, borrow restrictions, capacity growth, and copying optimizations using implementation snippets and benchmarks.
- Examples
- Shows a rejected resize during a slice borrow, observed capacity growth, and a release-mode copy benchmark.
- What you can do after
- Apply `Vec::with_capacity` when size is known, and use `copy_from_slice` for eligible copies.
Object-Oriented Software Design in C++
A dynamically sized sequential container that stores elements in contiguous order and manages an internal dynamically allocated array.
- How it is used
- Uses vectors to manage resizable collections in catalogues and appointment lists while illustrating their operational costs.
- How deep it goes
- Explains storage resizing, core operations, object copying, and a pointer-based alternative, but does not quantify complexity.
- Examples
- Demonstrates vectors through book catalogues, appointment dates, insertion, removal, printed output, and instrumented copy-constructor traces.
- What you can do after
- Evaluate vector usage and diagnose performance surprises caused by storing objects and triggering hidden copies.
Read how Object-Oriented Software Design in C++ explains vector →
Clojure: The Essential Reference
A vector is an ordered, indexed Clojure collection that stores values as sequential elements.
- How it is used
- Uses vectors for ordered, indexed values that support direct access and efficient tail operations.
- How deep it goes
- Explains operations, sequence behavior, and vec's input contract and array caveat, without detailing vector implementation internals.
- Examples
- Shows indexed access and updates, positional contains? results, and vec conversion with a Java-array aliasing example.
- What you can do after
- Apply it via Clojure's indexed operations and vec while distinguishing vectors from sequences and guarding against array aliasing.
Rust in Action: Systems programming concepts and techniques
A vector is a dynamically resizable, ordered collection of elements.
- How it is used
- Stores CSV fields and supports collecting matches and nearby lines in a grep-like search.
- How deep it goes
- Defines `Vec<T>` and works through creation, nesting, and capacity hints; stops short of implementing a vector.
- Examples
- Uses collected CSV fields and a two-pass grep-like search that groups numbered context lines.
- What you can do after
- Operates Rust's `Vec<T>` with `vec![]`, `push`, and `Vec::with_capacity` to collect search context.
Read how Rust in Action: Systems programming concepts and techniques explains vector →
Modern C, Third Edition
A dynamic array is an array-like data structure whose storage can be allocated or resized during program execution.
- How it is used
- Uses dynamic storage to implement a circular buffer whose capacity can be raised or lowered during execution.
- How deep it goes
- Explains representation, initialization, destruction, access, resizing, allocation failure, and wrapped-data movement.
- Examples
- Demonstrates a double-valued circular buffer with initialization, element access, resizing, allocation failure, and destruction.
- What you can do after
- Builds a resizable circular buffer and preserves valid ownership across allocation, resizing, access, and destruction.
Deep Learning with R, Third Edition
A vector is a quantity represented by an ordered collection of components and interpreted geometrically as a directed displacement or point relative to an origin.
- How it is used
- Defines vectors as the basic one-axis representation for numeric data and geometric points in neural-network computation.
- How deep it goes
- Explains rank, dimensionality, representations, geometric addition, and transformations, but stops short of formal derivations.
- Examples
- Uses an R five-entry array, vector addition for translation, and matrix products for rotation, scaling, and linear transformation.
- What you can do after
- Evaluate vector representations, distinguish rank from dimensionality, and interpret basic tensor operations geometrically.
Read how Deep Learning with R, Third Edition explains vector →
Julia as a Second Language
Vector is Julia's parametric one-dimensional array type for elements of a specified type.
- How it is used
- Represents ordered one-dimensional data for calculations, summaries, sorting, and elementwise transformations.
- How deep it goes
- Explains construction, indexing, column-row distinctions, common functions, mutation conventions, and elementwise arithmetic, while deferring deeper multidimensional work.
- Examples
- Uses pizza quantities and prices to demonstrate construction, averaging, sorting, taxation, elementwise multiplication, and total revenue.
- What you can do after
- Apply Julia vectors via indexing, sum, length, sort!, and dotted arithmetic to calculate and transform ordered data.
Learn Rust in a Month of Lunches
A vector is Rust's growable, heap-allocated sequence type whose elements share a type.
- How it is used
- Holds ordered collections whose size needs to change during program execution.
- How deep it goes
- Explains construction, element types, slicing, capacity, growth, and preallocation through focused examples.
- Examples
- Uses name vectors, integer vectors, vector slices, nested vectors, and capacity-printing programs.
- What you can do after
- Build vectors with Vec::new, vec!, push, explicit types, slicing, and Vec::with_capacity.
Related concepts
- arraykind of · An array is an indexed, ordered collection of elements arranged in one or more dimensions, with elements accessed by position.
- collectproduced by · collect is an operation that consumes produced values and gathers them into a collection or other result.
- fixed-size arrayimplements · A fixed-size array is an indexed collection whose storage capacity or length is established when it is created and remains unchanged.
- listincludes · A list is an ordered collection of elements arranged in a sequence.
- shuffleproduced by · Shuffling is the random rearrangement of elements in a collection, sequence, or dataset.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.










