Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Basic-Utilities

A collection of utilities and tools I use in several projects.

In my own projects, I often find myself using much of the same functionality both for use in the final project, and as part of the process (e.g. utility timers for evaluating executing speed). As such, I gathered several of the methods and objects I use frequently into this static library to centralise them and allow optimisations to one piece of code to apply to all projects.

The file layout of this project is also a little different from the standard generated by VS. As headers for static libraries are required in using the library, they have been separated from the source files into their own directory for easy access. They are found at MyLib/Headers; with the source files at MyLib/Source Files; and the pre-compiled lib file in the MyLib directory.

This code is built in C++17 and requires at least that standard to compile.

Library Contents.

This section will document a brief overview of each part of the library and what it contains.

  • PhysicsVector - A size-templated class to serve as a base vector object for physics simulations, with some optimisation targeting 2D and 3D vectors.

  • ConfigReader - A class to read configuration files and copy the valued contained within into the program at runtime.

  • SimpleTimer and MultiTimer - Classes which use the chrono header to track a single point in time, or multiple (respectively) and compare how much time has elapsed since.

  • IOFunctions - Some basic boilerplate IO functions to read in data through the console with input validation.

  • BigInt - A class to represent an arbitrarily sized (signed) integer, complete with arithmetic, comparison, and bitwise operators. Allows up to std::numeric_limits<std::size_t>::max()-bit integers before functionality breaks down. On the author's machine this corresponds to being able to represent ~5.55 x 1018 decimal digits, or a range of ± ~101018.74.

  • Defer - A utility to rip off Go defer execution of a particular statement or callable until the end of the current scope block. This can be done by constructing a named instance of class dp::Defer with a callable as the constructor argument. Or the icky but inarguably effective preprocessor macro DEFER(...) where the ... is an expression or expressions to be executed at the end of the current scope block.

  • Coroutine - A collection of coroutine handler types, specifically a generic Lazy<T> to lazily co_return a value, and Generator<T> for co_yielding generated values; as well as a common-functionality base class to help provide some of the necessary boilerplate in creating new coroutines. Unlike the rest of this library, this header requires C++20.

About

A collection of utilities and tools I use in several projects.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages