Results for “option”
Small, practical examples. Search by task or narrow things down below.
Read a variant only when it holds the expected type
C++: get_if returns a null pointer rather than throwing for another active alternative.
C++✓ Tested
Run a Compose service as a non-root user
Docker / Compose: user overrides the image’s default identity.
Docker / Compose✓ Tested
Run cleanup through a scoped destructor
C++: A stack object’s destructor runs when its scope exits, including normal exception unwinding.
C++✓ Tested
Set a Compose service’s working directory
Docker / Compose: working_dir changes where the container command starts.
Docker / Compose✓ Tested
Set a service’s open-file limit
Docker / Compose: The ulimits mapping defines soft and hard resource limits.
Docker / Compose✓ Tested
Set no-new-privileges in Compose
Docker / Compose: security_opt configures the process privilege restriction.
Docker / Compose✓ Tested
Share ownership with a counted smart pointer
C++: Copies of shared_ptr keep the owned value alive until the last owner is released.
C++✓ Tested
Stop collecting when parsing fails
Stop collecting when parsing fails in a complete Rust program using the standard library.
Rust✓ Tested
Store a reference in a standard container
C++: reference_wrapper preserves reference semantics while behaving like a copyable container element.
C++✓ Tested
Supply a default for an unset Compose variable
Docker / Compose: The default interpolation form supplies a value when the variable is absent or empty.
Docker / Compose✓ Tested
Supply a non-secret configuration file
Docker / Compose: A Compose config mounts a declared file into the service.
Docker / Compose✓ Tested
Transfer unique ownership with move
C++: Moving a unique_ptr leaves the source empty and gives ownership to the destination.
C++✓ Tested