Calico
|
A lens that negates the value before storing or accessing it. More...
#include <lens.hpp>
Public Types | |
typedef Lens | internal_type |
The type of the lens being wrapped. | |
typedef T | value_type |
The value type accepted by the lens. | |
Public Member Functions | |
negating_lens (internal_type &&data) | |
Wraps a lens. | |
internal_type | data () |
Returns the internal lens. | |
const internal_type & | data () const |
Returns the internal lens. | |
operator value_type () const | |
Gets the value through the lens. | |
negating_lens< Lens, T > & | operator%= (const value_type &x) |
Modulo assignment through the lens. | |
negating_lens< Lens, T > & | operator&= (const value_type &x) |
Bitwise AND assignment through the lens. | |
negating_lens< Lens, T > & | operator*= (const value_type &x) |
Multiplication assignment through the lens. | |
negating_lens< Lens, T > & | operator++ () |
Pre-increments through the lens. | |
negating_lens & | operator+= (const value_type &x) |
Addition assignment through the lens. | |
negating_lens< Lens, T > & | operator-- () |
Pre-decrements through the lens. | |
negating_lens & | operator-= (const value_type &x) |
Subtraction assignment through the lens. | |
negating_lens< Lens, T > & | operator/= (const value_type &x) |
Division assignment through the lens. | |
negating_lens< Lens, T > & | operator<<= (const value_type &x) |
Bitwise left shift assignment through the lens. | |
negating_lens & | operator= (const value_type &x) |
Puts a value through the lens. | |
negating_lens & | operator= (value_type &&x) |
Puts a value through the lens (rvalue version). | |
negating_lens< Lens, T > & | operator>>= (const value_type &x) |
Bitwise right shift assignment through the lens. | |
negating_lens< Lens, T > & | operator^= (const value_type &x) |
Bitwise XOR assignment through the lens. | |
negating_lens< Lens, T > & | operator|= (const value_type &x) |
Bitwise OR assignment through the lens. | |
A lens that negates the value before storing or accessing it.
If L
is the negating_lens
and x
is the internal lens, the following relationships are satisfied:
L == -x L = c <==> x = -c L += c <==> x -= c L -= c <==> x += c
The addition/subtraction-assignment operators are overloaded here to ensure better optimization for floating-point numbers (when -ffast-math
or its equivalent is not enabled).