Results for “Type & reading flow”
Small, practical examples. Search by task or narrow things down below.
Group matching values while preserving their order
C++: stable_partition keeps the relative order within both predicate groups.
C++✓ Tested
Handle a failed file open through stream state
C++: An unopened input stream is not an empty successful file read.
C++✓ Tested
Handle a failed string-to-integer conversion
C++: stoi throws invalid_argument when no conversion can be performed.
C++✓ Tested
Handle a result with a discriminated union
Separate success data from an error message.
discriminated union✓ Tested
Handle a terminating error
Catch conversion failures and produce a clear fallback.
try catch✓ Tested
Handle three possible outcomes
C++: Check high, normal and low values with an ordered conditional chain.
C++✓ Tested
Identify whether a name resolves to a builtin
Bash Scripts: type -t reports the command kind without printing a machine-specific path.
Bash Scripts✓ Tested
Ignore generated files
Exclude build output from untracked-file listings.
gitignore✓ Tested
Increment a shared counter safely
C++: Atomic increments prevent lost updates when two threads change the same counter.
C++✓ Tested
Increment a stored value in the database
SQL: An in-database arithmetic update avoids a separate application read-modify-write step.
SQL✓ Tested
Increment a stored value in the database
SQL Server: An in-database arithmetic update avoids a separate application read-modify-write step.
SQL Server✓ Tested
Increment a stored value in the database
Postgres: An in-database arithmetic update avoids a separate application read-modify-write step.
Postgres✓ Tested