Add optional set_*() methods.

Useful if you need a setter/getter pair,
for example to register them into some
other library.
This commit is contained in:
King_DuckZ 2021-04-04 14:42:37 +02:00
parent 3842f6c7b8
commit c5c982a9a4
1 changed files with 22 additions and 0 deletions

View File

@ -138,6 +138,13 @@ namespace vwr {
scalar_type& z ( void );
scalar_type& w ( void );
#if defined(VWR_EXTRA_SETTERS)
void set_x (const scalar_type& v) { x() = v; }
void set_y (const scalar_type& v) { y() = v; }
void set_z (const scalar_type& v) { z() = v; }
void set_w (const scalar_type& v) { w() = v; }
#endif
#if defined(VWR_EXTRA_ACCESSORS)
Vec<V> xyz0 ( void ) const { return Vec<V>(x(), y(), z(), scalar_type(0)); }
Vec<V> xyz1 ( void ) const { return Vec<V>(x(), y(), z(), scalar_type(1)); }
@ -164,6 +171,12 @@ namespace vwr {
scalar_type& y ( void );
scalar_type& z ( void );
#if defined(VWR_EXTRA_SETTERS)
void set_x (const scalar_type& v) { x() = v; }
void set_y (const scalar_type& v) { y() = v; }
void set_z (const scalar_type& v) { z() = v; }
#endif
#if defined(VWR_EXTRA_ACCESSORS)
Vec<V> xy0 ( void ) const { return Vec<V>(x(), y(), scalar_type(0)); }
Vec<V> xy1 ( void ) const { return Vec<V>(x(), y(), scalar_type(1)); }
@ -184,6 +197,11 @@ namespace vwr {
scalar_type& x ( void );
scalar_type& y ( void );
#if defined(VWR_EXTRA_SETTERS)
void set_x (const scalar_type& v) { x() = v; }
void set_y (const scalar_type& v) { y() = v; }
#endif
#if defined(VWR_EXTRA_ACCESSORS)
Vec<V> x0 ( void ) const { return Vec<V>(x(), scalar_type(0)); }
Vec<V> x1 ( void ) const { return Vec<V>(x(), scalar_type(1)); }
@ -198,6 +216,10 @@ namespace vwr {
typedef typename VectorWrapperInfo<V>::scalar_type scalar_type;
scalar_type& x ( void );
const scalar_type& x ( void ) const;
#if defined(VWR_EXTRA_SETTERS)
void set_x (const scalar_type& v) { x() = v; }
#endif
};
template <bool LastVal, typename V1, typename V2, typename ComposeOp, typename Op>