Stefan Scholz / ETL
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers pvoidvector.cpp Source File

pvoidvector.cpp

Go to the documentation of this file.
00001 ///\file
00002 
00003 /******************************************************************************
00004 The MIT License(MIT)
00005 
00006 Embedded Template Library.
00007 https://github.com/ETLCPP/etl
00008 http://www.etlcpp.com
00009 
00010 Copyright(c) 2016 jwellbelove
00011 
00012 Permission is hereby granted, free of charge, to any person obtaining a copy
00013 of this software and associated documentation files(the "Software"), to deal
00014 in the Software without restriction, including without limitation the rights
00015 to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
00016 copies of the Software, and to permit persons to whom the Software is
00017 furnished to do so, subject to the following conditions :
00018 
00019 The above copyright notice and this permission notice shall be included in all
00020 copies or substantial portions of the Software.
00021 
00022 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00023 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00024 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
00025 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00026 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00027 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
00028 SOFTWARE.
00029 ******************************************************************************/
00030 
00031 #include "../platform.h"
00032 #include "pvoidvector.h "
00033 
00034 namespace etl
00035 {
00036   //***************************************************************************
00037   /// Equal operator.
00038   ///\param lhs Reference to the first vector.
00039   ///\param rhs Reference to the second vector.
00040   ///\return <b>true</b> if the arrays are equal, otherwise <b>false</b>
00041   ///\ingroup vector
00042   //***************************************************************************
00043   bool operator ==(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs)
00044   {
00045     return (lhs.size() == rhs.size()) && std::equal(lhs.begin(), lhs.end(), rhs.begin());
00046   }
00047 
00048   //***************************************************************************
00049   /// Not equal operator.
00050   ///\param lhs Reference to the first vector.
00051   ///\param rhs Reference to the second vector.
00052   ///\return <b>true</b> if the arrays are not equal, otherwise <b>false</b>
00053   ///\ingroup vector
00054   //***************************************************************************
00055   bool operator !=(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs)
00056   {
00057     return !(lhs == rhs);
00058   }
00059 
00060   //***************************************************************************
00061   /// Less than operator.
00062   ///\param lhs Reference to the first vector.
00063   ///\param rhs Reference to the second vector.
00064   ///\return <b>true</b> if the first vector is lexicographically less than the second, otherwise <b>false</b>
00065   ///\ingroup vector
00066   //***************************************************************************
00067   inline bool operator <(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs)
00068   {
00069     return std::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
00070   }
00071 
00072   //***************************************************************************
00073   /// Greater than operator.
00074   ///\param lhs Reference to the first vector.
00075   ///\param rhs Reference to the second vector.
00076   ///\return <b>true</b> if the first vector is lexicographically greater than the second, otherwise <b>false</b>
00077   ///\ingroup vector
00078   //***************************************************************************
00079   bool operator >(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs)
00080   {
00081     return (rhs < lhs);
00082   }
00083 
00084   //***************************************************************************
00085   /// Less than or equal operator.
00086   ///\param lhs Reference to the first vector.
00087   ///\param rhs Reference to the second vector.
00088   ///\return <b>true</b> if the first vector is lexicographically less than or equal to the second, otherwise <b>false</b>
00089   ///\ingroup vector
00090   //***************************************************************************
00091   bool operator <=(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs)
00092   {
00093     return !(lhs > rhs);
00094   }
00095 
00096   //***************************************************************************
00097   /// Greater than or equal operator.
00098   ///\param lhs Reference to the first vector.
00099   ///\param rhs Reference to the second vector.
00100   ///\return <b>true</b> if the first vector is lexicographically greater than or equal to the second, otherwise <b>false</b>
00101   ///\ingroup vector
00102   //***************************************************************************
00103   bool operator >=(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs)
00104   {
00105     return !(lhs < rhs);
00106   }
00107 }
00108 
00109