mapping: add + operator
This allows cleaner arithmetic when adjusting mapping by an offset. Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
18c41ebfdf
commit
4a8ba9eb60
@ -55,6 +55,18 @@ namespace stdex
|
|||||||
/// \returns true if mappings are different or false otherwise
|
/// \returns true if mappings are different or false otherwise
|
||||||
///
|
///
|
||||||
bool operator!=(const mapping& other) const { return !operator==(other); }
|
bool operator!=(const mapping& other) const { return !operator==(other); }
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Adds two mappings by components
|
||||||
|
///
|
||||||
|
/// \param[in] other Second mapping
|
||||||
|
///
|
||||||
|
/// \returns Resulting mapping
|
||||||
|
///
|
||||||
|
mapping operator+(_In_ const mapping& other) const
|
||||||
|
{
|
||||||
|
return mapping(from + other.from, to + other.to);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T, class AX = std::allocator<mapping<T>>>
|
template <class T, class AX = std::allocator<mapping<T>>>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user