Commit graph

70 commits

Author SHA1 Message Date
a81c4c1077 Add support for 4D vectors. 2018-07-27 23:41:23 +01:00
08378698b8 Move VecBase stuff to its own .inl file. 2018-07-27 23:22:21 +01:00
e0e167b658 Split VecBase into a separate file.
vec_common is required as some definitions are needed by
both vectorwrapper and vec_base. I also wanted to keep
all of the define_has_* macro invocations together, for
clarity.
2018-07-27 23:08:36 +01:00
50ebba1c31 Merge branch 'vector_iterator' 2017-08-02 23:38:45 +01:00
d9dacb739a Properly stop looping when vec values go past the end. 2017-08-02 23:37:25 +01:00
421e5e2433 Allow extra casting if users explicitly whitelist them.
They'll have to make VectorTypeInfo<V> inherit from
is_castable_to<U> for every U they want the V to be
castable to. Note that if they also want U to be castable
to V (so the other way around) they'll have to explicitly
whitelist that conversion too in VectorTypeInfo<U>.
2017-07-27 23:42:21 +01:00
445d7b5e27 Forward to the other ctor. 2017-07-27 20:54:49 +01:00
e242f0b154 Allow an iteration step. 2017-07-27 20:48:52 +01:00
9dfa2b0545 Add a convenience operator<< overload for easy printing to std::cout. 2017-07-26 23:54:04 +01:00
2ff4301471 Use the last index, not just the last value in Vec. 2017-07-26 23:53:13 +01:00
42f3133640 Check that all indices are valid.
The code tries to make the compiler spit out which one is the
invalid index, if any.
2017-07-26 23:31:11 +01:00
c1b6bd0500 Add unit test for backwards iteration. 2017-07-26 22:48:39 +01:00
221f236f40 Finish implementing the sequence_range feature. 2017-07-26 21:16:19 +01:00
0e739c9582 Broken implementation of vector_iterator. WiP 2017-07-26 13:52:30 +01:00
b7616a4fcf Make sure to only match Vec<std::array> types. 2017-07-23 14:18:03 +01:00
f4715ec87f Add a sample gdb pretty printer for Vec<std::array> types 2017-07-23 14:02:44 +01:00
546bd7e270 Remove pointless symlink. 2017-03-16 21:33:46 +00:00
34e5775972 Don't put the path when including headers. 2017-03-16 20:58:49 +00:00
6ce534fc8a Update license header 2017-03-15 22:13:13 +00:00
83418105e3 static_cast assignments by default.
This can be disabled by defining VWR_WITH_UNCASTED_ASSIGNMENT.
2017-03-11 08:45:11 +00:00
33bc1e73da Use pragma once instead of inclusion guards.
Multiple versions of the same library can't be used in the same
project because even tho project take care to include from
the right vectorwrapper-1.0/ dir the inclusion guard is the
same. So in spite of having a different path and livingi in a
different namespace, ifndef is preventing the inclusions to work.
2017-03-04 01:19:15 +00:00
9533c73cd6 Add versioned symlink to include directory 2017-03-04 01:00:39 +00:00
db7b9becd5 Let users specify a wrapping namespace.
This is useful when vwr is used and publicly exposed in a
library. If both the library and the standalone project depend
on vwr, this change gives the user the opportunity to keep the
two usages separate. This is especially important if both the
library and the standalone program happen to specialize the
Info template for the same type.
2017-03-04 00:04:40 +00:00
aaa8e75dc1 Implement 2D and 3D cross product.
2D cross product is defined as equivalent to:
res = cross(a.xy0(), b.xy0()).z()
2017-02-01 01:51:52 +00:00
fc7b666429 Add optional methods like yx(), x1(), x0() etc...
You need to define VWR_EXTRA_ACCESSORS if you want those
to be available in your build.
2017-01-27 19:24:27 +00:00
69e342460c Implement binary assignment operators for scalar types. 2017-01-27 19:07:15 +00:00
48d7b5ddec Replace implementation of binary op assignments.
Use variadic templates instead of for loops. Add unit test.
2017-01-27 19:02:52 +00:00
bbaabb695d Implement operators with scalar types. 2017-01-27 18:43:21 +00:00
780e6647b2 Implement unary operator- 2017-01-26 17:28:17 +00:00
2f4d319675 Implement binary operators.
This also has the benefical side effect of ridding me of that
stupid VWR_STATIC_CAST_RESULTS macro.
2016-11-08 02:24:21 +01:00
6bf3278631 Implement comparison operators correctly.
With tests.
2016-11-08 01:51:17 +01:00
00470290fe Change hardcoded std::size_t into size_type so it can be customised.
Define VWR_SIZE_TYPE to the type you want to use as the template
index type. It defaults to std::size_t so if you don't do anything
you still get the old behaviour.

Also drop the std::index_range in vector_cast in favour of the custom
bt::number_range, which is already used elsewhere in the code.
2016-11-02 03:53:22 +01:00
c3844dc246 Update sequence_bt from duckhandy. 2016-11-02 03:37:01 +01:00
8af1a36baa Warning fix on clang 2016-11-02 02:45:16 +01:00
d9ac0531b3 Fix warning about unused typedef. 2016-11-02 01:31:48 +01:00
0c78771c3e Try to get gcc-5 (please travis, just work!) 2016-11-02 01:19:48 +01:00
891fa25675 Add vector_cast implementation and the unit test for it. 2016-11-02 01:19:48 +01:00
dc1b3e7b76 Use ctest in cmake. 2016-11-02 01:19:48 +01:00
f51c739a48 Add a macro to control if the result of binary operators should be casted.
It allows to suppress warnings when combining vectors of a type that
gets promoted to int after the binary operator is applied, for example.
2016-11-02 01:14:23 +01:00
6ab4d586eb Disable implicit conversions by default and update readme.
Implicit conversions are still needed for the old unit test to build.
2016-11-02 01:12:00 +01:00
2725d4f63d Update copyright to 2016
I think vectorops was missing the copyright header /on purpose/ but
I've added it there as well now.
2016-11-01 22:58:23 +01:00
736e83893a Add test for wrapped vector using get_at() which was not working previously. 2016-10-25 01:18:44 +02:00
84203ee817 Fix broken build when using the get_at() way wrapper. 2016-10-25 01:07:28 +02:00
41eed2c8ba Warning fix 2016-09-05 21:30:17 +02:00
dbfed8c124 Add notes about example.cpp and about performance. 2015-07-25 22:12:44 +02:00
f682168382 Remove Build status section. 2015-07-25 21:58:56 +02:00
7affd7960f Allow casting to vectors of lower dimensions. 2015-07-25 21:18:45 +02:00
fe03f45f76 Add an example.cpp unit test to demonstrate usage.
Shows what it looks like when you mix vectors of different
type vs using vectorwrapper.
2015-07-25 20:55:52 +02:00
958de67849 Make scalar_type and vector_type public in Vec.
- Add a dot product implementation.
- Test code to demonstrate dot product.
- Test code to demonstrate wrapping structs with unordered properties.
2015-07-25 19:41:16 +02:00
40ca5cd388 Clarify cast conditions. 2015-07-25 19:20:20 +02:00