The CPP-GL library provides an option to enable force inlining of seleced functions and methods in the implementation. This is defined through the gl_attr_force_inline macro, which by default is equivalent to the inline keyword.
To enable the force inlining functionality you have to add the following in your program:
#define GL_CONFIG_FORCE_INLINENote
Force inlining is supported only for the GNU G++ and CLang++ compilers.
Small helpers for working with C++20 ranges.
Note
- Header: gl/util/ranges.hpp
- Namespace:
gl::util
deref_view- Description: A transform view that dereferences pointer-like elements in a range. Useful for turning a range of pointers or smart pointers into a range of references.
- Usage:
range | gl::util::deref_view - Works with:
T*,std::unique_ptr<T>,std::shared_ptr<T>, and generally pointer-like objects supporting unary*. - Return type: A lazy transformed view whose reference type is
decltype(*p)of the underlying elements. - Example:
std::vector<std::unique_ptr<int>> v; /* ... */ for (int& x : v | gl::util::deref_view) { // use x as an int& }
range_size(r)- Template parameters:
R: std::ranges::range
- Description: Returns the size of a range. If
Rmodelsstd::ranges::sized_range, it forwards tostd::ranges::size(r)in O(1). Otherwise, it computesstd::ranges::distance(std::begin(r), std::end(r))in O(n). - Parameters:
r: R&&– the input range.
- Return type: Same type as produced by
std::ranges::size(r)for sized ranges orstd::ranges::distance(...)otherwise. - Complexity: O(1) for sized ranges; O(n) otherwise.
- Exceptions: No specific exceptions; propagates iterator operations if they throw.
- Template parameters:
Caution
For non-sized, single-pass/input ranges range_size will consume the range when computing distance.