/* * Author: Patrick-Christopher Mattulat * Company: Lynar Studios * E-Mail: webmaster@lynarstudios.com * Created: 2023-02-10 * Changed: 2024-05-31 * * */ #include #include using ls::std::core::IndexOutOfBoundsEvaluator; using ls::std::core::IndexOutOfBoundsException; using std::move; using std::string; IndexOutOfBoundsEvaluator::IndexOutOfBoundsEvaluator(const size_t _index, const size_t _size) : index(_index), size(_size) {} IndexOutOfBoundsEvaluator::IndexOutOfBoundsEvaluator(const size_t _index, const size_t _size, string _message) : index(_index), message(::move(_message)), size(_size) {} IndexOutOfBoundsEvaluator::~IndexOutOfBoundsEvaluator() noexcept = default; void IndexOutOfBoundsEvaluator::evaluate() { if (this->index >= this->size) { if (this->message.empty()) { throw IndexOutOfBoundsException{}; } throw IndexOutOfBoundsException{this->message}; } }