FIND YOUR NEXT FEW LINES

Results for “values”

Small, practical examples. Search by task or narrow things down below.

308 snippets foundClear filters
RustErrors & optional values

Propagate a parsing error with question mark

Propagate a parsing error with question mark in a complete Rust program using the standard library.

Rust✓ Tested
RustErrors & optional values

Provide a default for a missing value

Provide a default for a missing value in a complete Rust program using the standard library.

Rust✓ Tested
JavaEncoding & structured values

Read a big-endian integer from bytes

Java: Set a byte order explicitly when handling a binary protocol.

Java✓ Tested
C++Ownership & optional values

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
C++Containers & compound values

Remove a map entry and inspect the number removed

C++: erase by key reports whether a unique-key map contained the entry.

C++✓ Tested
C++Ownership & optional values

Represent an absent result with optional

C++: value_or supplies a default without requiring a sentinel inside the value domain.

C++✓ Tested
Arduino / CBinary values & packets

Require every bit in a mask

Arduino / C: Masking followed by equality tests whether all required flags are set.

Arduino / C✓ Tested
C++Ownership & optional values

Run cleanup through a scoped destructor

C++: A stack object’s destructor runs when its scope exits, including normal exception unwinding.

C++✓ Tested
C++Ownership & optional values

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
RustErrors & optional values

Stop collecting when parsing fails

Stop collecting when parsing fails in a complete Rust program using the standard library.

Rust✓ Tested
C++Ownership & optional values

Store a reference in a standard container

C++: reference_wrapper preserves reference semantics while behaving like a copyable container element.

C++✓ Tested
C++Containers & compound values

Store and inspect a fixed set of bits

C++: bitset offers named operations and a readable binary representation.

C++✓ Tested