14#ifndef DLINEAR_ENABLED_QSOPTEX
15#error QSopt_ex is not enabled. Please enable it by adding "--//tools:enable_qsoptex" to the bazel command.
21#include <qsopt_ex/QSopt_ex.h>
72 explicit MpqArray(
size_t n_elements);
83 explicit operator const mpq_t *()
const {
return array_; }
89 explicit operator mpq_t *() {
return array_; }
91 mpq_t &operator[](
const int idx) {
return array_[idx]; }
93 const mpq_t &operator[](
const int idx)
const {
return array_[idx]; }
96 [[nodiscard]]
size_t size()
const {
return array_ ?
reinterpret_cast<size_t *
>(
array_)[-1] : 0; }
104 void Resize(
size_t nElements);
A wrapper around an array of mpq_t elements.
void Resize(size_t nElements)
Resize the array to have nElements elements.
MpqArray(size_t n_elements)
Construct a new MpqArray object, allocating the array with n_elements elements.
mpq_t * array_
array of mpq_t. It is allocated by AllocateMpqArray() and freed by FreeMpqArray().
void AllocateMpqArray(size_t n_elements)
Allocate the array with n_elements elements.
void FreeMpqArray()
Free the array of mpq_t.
~MpqArray()
Destroy the MpqArray object, freeing the array.
size_t size() const
Get read-only access to the size of the array.
mpq_class * CStringToMpqPtr(const char str[])
Convert a C-string to a mpq_class.
mpq_class CStringToMpq(const char str[])
Convert a string to a mpq_class.
mpq_class StringToMpq(const std::string &str)
Convert a string to a mpq_class.
mpq_class * StringToMpqPtr(const std::string &str)
Convert a string to a mpq_class.