The repository ships runnable examples under examples/. This
index is meant for quick entry points: find the smallest program that matches
the relevant feature and start there.
- examples/container/quick.cpp: shortest path from registration to resolution
- examples/registration/non_intrusive.cpp: registration shape and policy deduction without touching user types
- examples/factory/factory_constructor_deduction.cpp: what the default constructor selection does
- examples/factory/factory_constructor.cpp: how to pin construction to a specific overload
- examples/factory/factory_function.cpp: static member-function-based construction
- examples/factory/factory_callable.cpp: stateful callable-based construction with injected arguments
- examples/storage/scope_external.cpp: use an existing object without moving ownership into the container
- examples/storage/scope_unique.cpp: create a fresh instance on every resolution
- examples/storage/scope_shared.cpp: cache and reuse a single stored instance
- examples/storage/scope_shared_cyclical.cpp: resolve cyclic graphs through two-phase construction
- examples/storage/array.cpp: register and resolve raw arrays plus smart-array forms
- examples/container/variant.cpp: construct variants and resolve either the whole variant or its held alternative from variant storage
- examples/container/service_locator.cpp: resolve a concrete type through an interface view
- examples/index/multibindings.cpp: resolve multiple implementations through a single interface
- examples/registration/collection.cpp: aggregate a custom collection shape with a custom insertion step
- examples/index/message_processing.cpp: route messages to indexed handlers
- examples/container/construct.cpp: build an unmanaged object from registered dependencies
- examples/container/invoke.cpp: invoke a callable with injected arguments supplied by the container
- examples/index/index.cpp: resolve by interface and runtime key
- examples/container/nesting.cpp: override registrations in a parent-child container chain
- examples/container/allocator.cpp: provide a custom allocator for container bookkeeping
Examples are enabled through the development build:
cmake -S . -B build -DDINGO_DEVELOPMENT_MODE=ON -DDINGO_EXAMPLES_ENABLED=ON
cmake --build build
ctest --test-dir build --output-on-failure