Containers (STL-compatible) StateMachines MessageBus and more for Embedded Systems. See www.etlcpp.com
private/pvoidvector.cpp@0:b47c2a7920c2, 2018-03-16 (annotated)
- Committer:
- bobbery
- Date:
- Fri Mar 16 16:34:18 2018 +0000
- Revision:
- 0:b47c2a7920c2
Works after using gcc_generic undef CAPACITY and replacing nullptr by std::nullptr
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bobbery | 0:b47c2a7920c2 | 1 | ///\file |
bobbery | 0:b47c2a7920c2 | 2 | |
bobbery | 0:b47c2a7920c2 | 3 | /****************************************************************************** |
bobbery | 0:b47c2a7920c2 | 4 | The MIT License(MIT) |
bobbery | 0:b47c2a7920c2 | 5 | |
bobbery | 0:b47c2a7920c2 | 6 | Embedded Template Library. |
bobbery | 0:b47c2a7920c2 | 7 | https://github.com/ETLCPP/etl |
bobbery | 0:b47c2a7920c2 | 8 | http://www.etlcpp.com |
bobbery | 0:b47c2a7920c2 | 9 | |
bobbery | 0:b47c2a7920c2 | 10 | Copyright(c) 2016 jwellbelove |
bobbery | 0:b47c2a7920c2 | 11 | |
bobbery | 0:b47c2a7920c2 | 12 | Permission is hereby granted, free of charge, to any person obtaining a copy |
bobbery | 0:b47c2a7920c2 | 13 | of this software and associated documentation files(the "Software"), to deal |
bobbery | 0:b47c2a7920c2 | 14 | in the Software without restriction, including without limitation the rights |
bobbery | 0:b47c2a7920c2 | 15 | to use, copy, modify, merge, publish, distribute, sublicense, and / or sell |
bobbery | 0:b47c2a7920c2 | 16 | copies of the Software, and to permit persons to whom the Software is |
bobbery | 0:b47c2a7920c2 | 17 | furnished to do so, subject to the following conditions : |
bobbery | 0:b47c2a7920c2 | 18 | |
bobbery | 0:b47c2a7920c2 | 19 | The above copyright notice and this permission notice shall be included in all |
bobbery | 0:b47c2a7920c2 | 20 | copies or substantial portions of the Software. |
bobbery | 0:b47c2a7920c2 | 21 | |
bobbery | 0:b47c2a7920c2 | 22 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
bobbery | 0:b47c2a7920c2 | 23 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
bobbery | 0:b47c2a7920c2 | 24 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE |
bobbery | 0:b47c2a7920c2 | 25 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
bobbery | 0:b47c2a7920c2 | 26 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
bobbery | 0:b47c2a7920c2 | 27 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
bobbery | 0:b47c2a7920c2 | 28 | SOFTWARE. |
bobbery | 0:b47c2a7920c2 | 29 | ******************************************************************************/ |
bobbery | 0:b47c2a7920c2 | 30 | |
bobbery | 0:b47c2a7920c2 | 31 | #include "../platform.h" |
bobbery | 0:b47c2a7920c2 | 32 | #include "pvoidvector.h" |
bobbery | 0:b47c2a7920c2 | 33 | |
bobbery | 0:b47c2a7920c2 | 34 | namespace etl |
bobbery | 0:b47c2a7920c2 | 35 | { |
bobbery | 0:b47c2a7920c2 | 36 | //*************************************************************************** |
bobbery | 0:b47c2a7920c2 | 37 | /// Equal operator. |
bobbery | 0:b47c2a7920c2 | 38 | ///\param lhs Reference to the first vector. |
bobbery | 0:b47c2a7920c2 | 39 | ///\param rhs Reference to the second vector. |
bobbery | 0:b47c2a7920c2 | 40 | ///\return <b>true</b> if the arrays are equal, otherwise <b>false</b> |
bobbery | 0:b47c2a7920c2 | 41 | ///\ingroup vector |
bobbery | 0:b47c2a7920c2 | 42 | //*************************************************************************** |
bobbery | 0:b47c2a7920c2 | 43 | bool operator ==(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs) |
bobbery | 0:b47c2a7920c2 | 44 | { |
bobbery | 0:b47c2a7920c2 | 45 | return (lhs.size() == rhs.size()) && std::equal(lhs.begin(), lhs.end(), rhs.begin()); |
bobbery | 0:b47c2a7920c2 | 46 | } |
bobbery | 0:b47c2a7920c2 | 47 | |
bobbery | 0:b47c2a7920c2 | 48 | //*************************************************************************** |
bobbery | 0:b47c2a7920c2 | 49 | /// Not equal operator. |
bobbery | 0:b47c2a7920c2 | 50 | ///\param lhs Reference to the first vector. |
bobbery | 0:b47c2a7920c2 | 51 | ///\param rhs Reference to the second vector. |
bobbery | 0:b47c2a7920c2 | 52 | ///\return <b>true</b> if the arrays are not equal, otherwise <b>false</b> |
bobbery | 0:b47c2a7920c2 | 53 | ///\ingroup vector |
bobbery | 0:b47c2a7920c2 | 54 | //*************************************************************************** |
bobbery | 0:b47c2a7920c2 | 55 | bool operator !=(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs) |
bobbery | 0:b47c2a7920c2 | 56 | { |
bobbery | 0:b47c2a7920c2 | 57 | return !(lhs == rhs); |
bobbery | 0:b47c2a7920c2 | 58 | } |
bobbery | 0:b47c2a7920c2 | 59 | |
bobbery | 0:b47c2a7920c2 | 60 | //*************************************************************************** |
bobbery | 0:b47c2a7920c2 | 61 | /// Less than operator. |
bobbery | 0:b47c2a7920c2 | 62 | ///\param lhs Reference to the first vector. |
bobbery | 0:b47c2a7920c2 | 63 | ///\param rhs Reference to the second vector. |
bobbery | 0:b47c2a7920c2 | 64 | ///\return <b>true</b> if the first vector is lexicographically less than the second, otherwise <b>false</b> |
bobbery | 0:b47c2a7920c2 | 65 | ///\ingroup vector |
bobbery | 0:b47c2a7920c2 | 66 | //*************************************************************************** |
bobbery | 0:b47c2a7920c2 | 67 | inline bool operator <(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs) |
bobbery | 0:b47c2a7920c2 | 68 | { |
bobbery | 0:b47c2a7920c2 | 69 | return std::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); |
bobbery | 0:b47c2a7920c2 | 70 | } |
bobbery | 0:b47c2a7920c2 | 71 | |
bobbery | 0:b47c2a7920c2 | 72 | //*************************************************************************** |
bobbery | 0:b47c2a7920c2 | 73 | /// Greater than operator. |
bobbery | 0:b47c2a7920c2 | 74 | ///\param lhs Reference to the first vector. |
bobbery | 0:b47c2a7920c2 | 75 | ///\param rhs Reference to the second vector. |
bobbery | 0:b47c2a7920c2 | 76 | ///\return <b>true</b> if the first vector is lexicographically greater than the second, otherwise <b>false</b> |
bobbery | 0:b47c2a7920c2 | 77 | ///\ingroup vector |
bobbery | 0:b47c2a7920c2 | 78 | //*************************************************************************** |
bobbery | 0:b47c2a7920c2 | 79 | bool operator >(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs) |
bobbery | 0:b47c2a7920c2 | 80 | { |
bobbery | 0:b47c2a7920c2 | 81 | return (rhs < lhs); |
bobbery | 0:b47c2a7920c2 | 82 | } |
bobbery | 0:b47c2a7920c2 | 83 | |
bobbery | 0:b47c2a7920c2 | 84 | //*************************************************************************** |
bobbery | 0:b47c2a7920c2 | 85 | /// Less than or equal operator. |
bobbery | 0:b47c2a7920c2 | 86 | ///\param lhs Reference to the first vector. |
bobbery | 0:b47c2a7920c2 | 87 | ///\param rhs Reference to the second vector. |
bobbery | 0:b47c2a7920c2 | 88 | ///\return <b>true</b> if the first vector is lexicographically less than or equal to the second, otherwise <b>false</b> |
bobbery | 0:b47c2a7920c2 | 89 | ///\ingroup vector |
bobbery | 0:b47c2a7920c2 | 90 | //*************************************************************************** |
bobbery | 0:b47c2a7920c2 | 91 | bool operator <=(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs) |
bobbery | 0:b47c2a7920c2 | 92 | { |
bobbery | 0:b47c2a7920c2 | 93 | return !(lhs > rhs); |
bobbery | 0:b47c2a7920c2 | 94 | } |
bobbery | 0:b47c2a7920c2 | 95 | |
bobbery | 0:b47c2a7920c2 | 96 | //*************************************************************************** |
bobbery | 0:b47c2a7920c2 | 97 | /// Greater than or equal operator. |
bobbery | 0:b47c2a7920c2 | 98 | ///\param lhs Reference to the first vector. |
bobbery | 0:b47c2a7920c2 | 99 | ///\param rhs Reference to the second vector. |
bobbery | 0:b47c2a7920c2 | 100 | ///\return <b>true</b> if the first vector is lexicographically greater than or equal to the second, otherwise <b>false</b> |
bobbery | 0:b47c2a7920c2 | 101 | ///\ingroup vector |
bobbery | 0:b47c2a7920c2 | 102 | //*************************************************************************** |
bobbery | 0:b47c2a7920c2 | 103 | bool operator >=(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs) |
bobbery | 0:b47c2a7920c2 | 104 | { |
bobbery | 0:b47c2a7920c2 | 105 | return !(lhs < rhs); |
bobbery | 0:b47c2a7920c2 | 106 | } |
bobbery | 0:b47c2a7920c2 | 107 | } |
bobbery | 0:b47c2a7920c2 | 108 | |
bobbery | 0:b47c2a7920c2 | 109 |