Commit graph

14 commits

Author SHA1 Message Date
Kp dded433d2b Return sentinel type from xrange::end() 2022-10-09 23:15:20 +00:00
Kp f61db8ae7a Make enumerate() default to std::size_t for index_type
Change from `uint_fast32_t` to `std::size_t` for consistency with how
arrays are typically indexed.

Change the decltype() lookup to use a non-template function for the
fallback case.

Move the remove_reference logic into the caller, to allow fewer
instantiations of `array_index_type`.
2022-10-09 23:15:20 +00:00
Kp a8c4aee5f0 Fix compilation of valptridx unit tests
Newer gcc has become more effective at propagating values and now proves
that certain tests will always throw.  This proof triggers a
compile-time error, which is desirable in the main program, but not in
the unit test.  Add an indirection to hide the value from the compiler
so that it is forced to emit runtime code, which can then throw and
catch as intended.
2022-10-02 19:51:35 +00:00
Kp 72064c62e7 Add unit tests for enumerate 2022-02-13 19:13:38 +00:00
Kp 328046d1ba Use xrange for texture merge loops 2021-12-01 03:15:21 +00:00
Kp eea806bcc9 Pass underlying index_type through zip()
If std::common_type<range::index_type>... finds a common index_type
among all the zipped ranges, pass that common type through as
zip<...>::index_type.  Otherwise, set zip<...>::index_type to void.

This allows enumerate(zip(...))) to report a better index_type.
2021-11-01 03:37:20 +00:00
Kp b6bebcf6b8 Propagate T::index_type through partial_range
When partial_range is used on a container that defines index_type,
define that same index_type on the partial_range.  This allows other
callers, such as enumerate(), to maintain the correct index type.
2021-09-04 12:17:14 +00:00
Kp 23f03d0a5e Add unit tests for partial_range 2021-09-04 12:17:14 +00:00
Kp d748e7bbfc Add support for xrange steps other than +1
Prior to this, an xrange always started at the begin term and
incremented by 1 per step until it reached the end term.  There was no
support for a step size other than 1.  Add support for custom step size.
It is the caller's responsibility to pick a step size that will
eventually lead to (iter != end) evaluating to false.
2021-08-26 03:13:45 +00:00
Kp 6a4a8a62c9 Add unit tests for serialization code 2020-05-17 23:35:25 +00:00
Kp 0b070880a7 Use C++11 user-defined literals to dispatch valptridx error style
Switch valptridx error style dispatching from using macro pasting to
using C++11 user-defined literals.  This makes the code a bit easier to
read, and removes the need for a C99-conforming preprocessor here, which
should help anyone trying to port to Microsoft Visual Studio.

The new implementation also fixes a limitation of the previous
implementation.  Before, an override that referenced an invalid name
could be silently ignored.  Now, incorrect overrides cause an attempt to
use an undefined instantiation, which fails with a compilation error.
2020-04-26 17:26:23 +00:00
Kp aaaf212dca Add unit test for zip iterator 2020-02-26 05:07:34 +00:00
Kp b6e782d128 Add unit tests for xrange 2020-02-01 22:33:31 +00:00
Kp 2a82207e91 Add unit tests for valptridx parameter validation 2018-06-17 05:04:38 +00:00