1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820
|
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2016 John Wellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_PVOIDVECTOR_INCLUDED
#define ETL_PVOIDVECTOR_INCLUDED
#define ETL_IN_PVOIDVECTOR
#include "../platform.h"
#include "../algorithm.h"
#include "vector_base.h"
#include "../type_traits.h"
#include "../error_handler.h"
#include "../functional.h"
#include "../iterator.h"
#include <stddef.h>
#include "minmax_push.h"
namespace etl
{
//***************************************************************************
/// The base class for void* vectors.
///\ingroup vector
//***************************************************************************
class pvoidvector : public vector_base
{
public:
typedef void* value_type;
typedef value_type& reference;
typedef const value_type& const_reference;
typedef value_type* pointer;
typedef const value_type* const_pointer;
typedef value_type* iterator;
typedef const value_type* const_iterator;
typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef size_t size_type;
typedef etl::iterator_traits<iterator>::difference_type difference_type;
public:
//*********************************************************************
/// Returns an iterator to the beginning of the vector.
///\return An iterator to the beginning of the vector.
//*********************************************************************
iterator begin()
{
return p_buffer;
}
//*********************************************************************
/// Returns a const_iterator to the beginning of the vector.
///\return A const iterator to the beginning of the vector.
//*********************************************************************
const_iterator begin() const
{
return const_iterator(p_buffer);
}
//*********************************************************************
/// Returns an iterator to the end of the vector.
///\return An iterator to the end of the vector.
//*********************************************************************
iterator end()
{
return p_end;
}
//*********************************************************************
/// Returns a const_iterator to the end of the vector.
///\return A const iterator to the end of the vector.
//*********************************************************************
const_iterator end() const
{
return const_iterator(p_end);
}
//*********************************************************************
/// Returns a const_iterator to the beginning of the vector.
///\return A const iterator to the beginning of the vector.
//*********************************************************************
const_iterator cbegin() const
{
return const_iterator(p_buffer);
}
//*********************************************************************
/// Returns a const_iterator to the end of the vector.
///\return A const iterator to the end of the vector.
//*********************************************************************
const_iterator cend() const
{
return const_iterator(p_end);
}
//*********************************************************************
/// Returns an reverse iterator to the reverse beginning of the vector.
///\return Iterator to the reverse beginning of the vector.
//*********************************************************************
reverse_iterator rbegin()
{
return reverse_iterator(end());
}
//*********************************************************************
/// Returns a const reverse iterator to the reverse beginning of the vector.
///\return Const iterator to the reverse beginning of the vector.
//*********************************************************************
const_reverse_iterator rbegin() const
{
return const_reverse_iterator(end());
}
//*********************************************************************
/// Returns a reverse iterator to the end + 1 of the vector.
///\return Reverse iterator to the end + 1 of the vector.
//*********************************************************************
reverse_iterator rend()
{
return reverse_iterator(begin());
}
//*********************************************************************
/// Returns a const reverse iterator to the end + 1 of the vector.
///\return Const reverse iterator to the end + 1 of the vector.
//*********************************************************************
const_reverse_iterator rend() const
{
return const_reverse_iterator(begin());
}
//*********************************************************************
/// Returns a const reverse iterator to the reverse beginning of the vector.
///\return Const reverse iterator to the reverse beginning of the vector.
//*********************************************************************
const_reverse_iterator crbegin() const
{
return const_reverse_iterator(cend());
}
//*********************************************************************
/// Returns a const reverse iterator to the end + 1 of the vector.
///\return Const reverse iterator to the end + 1 of the vector.
//*********************************************************************
const_reverse_iterator crend() const
{
return const_reverse_iterator(cbegin());
}
//*********************************************************************
/// Resizes the vector.
/// If asserts or exceptions are enabled and the new size is larger than the
/// maximum then a vector_full is thrown.
///\param new_size The new size.
//*********************************************************************
void resize(size_t new_size)
{
ETL_ASSERT_OR_RETURN(new_size <= CAPACITY, ETL_ERROR(vector_full));
p_end = p_buffer + new_size;
}
//*********************************************************************
/// Resizes the vector.
/// If asserts or exceptions are enabled and the new size is larger than the
/// maximum then a vector_full is thrown.
///\param new_size The new size.
///\param value The value to fill new elements with. Default = default constructed value.
//*********************************************************************
void resize(size_t new_size, value_type value)
{
ETL_ASSERT_OR_RETURN(new_size <= CAPACITY, ETL_ERROR(vector_full));
pointer p_new_end = p_buffer + new_size;
// Size up if necessary.
if (p_end < p_new_end)
{
etl::fill(p_end, p_new_end, value);
}
p_end = p_new_end;
}
//*********************************************************************
/// Resizes the vector, but does not initialise new entries.
///\param new_size The new size.
//*********************************************************************
void uninitialized_resize(size_t new_size)
{
ETL_ASSERT_OR_RETURN(new_size <= CAPACITY, ETL_ERROR(vector_full));
p_end = p_buffer + new_size;
}
//*********************************************************************
/// Returns a reference to the value at index 'i'
///\param i The index.
///\return A reference to the value at index 'i'
//*********************************************************************
reference operator [](size_t i)
{
return p_buffer[i];
}
//*********************************************************************
/// Returns a const reference to the value at index 'i'
///\param i The index.
///\return A const reference to the value at index 'i'
//*********************************************************************
const_reference operator [](size_t i) const
{
return p_buffer[i];
}
//*********************************************************************
/// Returns a reference to the value at index 'i'
/// If asserts or exceptions are enabled, emits an etl::vector_out_of_bounds if the index is out of range.
///\param i The index.
///\return A reference to the value at index 'i'
//*********************************************************************
reference at(size_t i)
{
ETL_ASSERT(i < size(), ETL_ERROR(vector_out_of_bounds));
return p_buffer[i];
}
//*********************************************************************
/// Returns a const reference to the value at index 'i'
/// If asserts or exceptions are enabled, emits an etl::vector_out_of_bounds if the index is out of range.
///\param i The index.
///\return A const reference to the value at index 'i'
//*********************************************************************
const_reference at(size_t i) const
{
ETL_ASSERT(i < size(), ETL_ERROR(vector_out_of_bounds));
return p_buffer[i];
}
//*********************************************************************
/// Returns a reference to the first element.
///\return A reference to the first element.
//*********************************************************************
reference front()
{
return p_buffer[0];
}
//*********************************************************************
/// Returns a const reference to the first element.
///\return A const reference to the first element.
//*********************************************************************
const_reference front() const
{
return p_buffer[0];
}
//*********************************************************************
/// Returns a reference to the last element.
///\return A reference to the last element.
//*********************************************************************
reference back()
{
return *(p_end - 1);
}
//*********************************************************************
/// Returns a const reference to the last element.
///\return A const reference to the last element.
//*********************************************************************
const_reference back() const
{
return *(p_end - 1);
}
//*********************************************************************
/// Returns a pointer to the beginning of the vector data.
///\return A pointer to the beginning of the vector data.
//*********************************************************************
pointer data()
{
return p_buffer;
}
//*********************************************************************
/// Returns a const pointer to the beginning of the vector data.
///\return A const pointer to the beginning of the vector data.
//*********************************************************************
const_pointer data() const
{
return p_buffer;
}
//*********************************************************************
/// Assigns values to the vector. Non-pointer
/// If asserts or exceptions are enabled, emits vector_full if the vector does not have enough free space.
/// If asserts or exceptions are enabled, emits vector_iterator if the iterators are reversed.
///\param first The iterator to the first element.
///\param last The iterator to the last element + 1.
//*********************************************************************
template <typename TIterator>
typename etl::enable_if<!etl::is_pointer<TIterator>::value, void>::type
assign(TIterator first, TIterator last)
{
#if ETL_IS_DEBUG_BUILD
difference_type d = etl::distance(first, last);
ETL_ASSERT_OR_RETURN(static_cast<size_t>(d) <= CAPACITY, ETL_ERROR(vector_full));
#endif
initialise();
while (first != last)
{
*p_end++ = (void*)(*first);
++first;
}
}
//*********************************************************************
/// Assigns values to the vector. Pointer
/// If asserts or exceptions are enabled, emits vector_full if the vector does not have enough free space.
/// If asserts or exceptions are enabled, emits vector_iterator if the iterators are reversed.
///\param first The iterator to the first element.
///\param last The iterator to the last element + 1.
//*********************************************************************
template <typename TIterator>
typename etl::enable_if<etl::is_pointer<TIterator>::value, void>::type
assign(TIterator first, TIterator last)
{
#if ETL_IS_DEBUG_BUILD
difference_type d = etl::distance(first, last);
ETL_ASSERT_OR_RETURN(static_cast<size_t>(d) <= CAPACITY, ETL_ERROR(vector_full));
#endif
initialise();
void** p_first = (void**)(first);
void** p_last = (void**)(last);
p_end = etl::copy(p_first, p_last, p_buffer);
}
//*********************************************************************
/// Assigns values to the vector.
/// If asserts or exceptions are enabled, emits vector_full if the vector does not have enough free space.
///\param n The number of elements to add.
///\param value The value to insert for each element.
//*********************************************************************
void assign(size_t n, value_type value)
{
ETL_ASSERT_OR_RETURN(n <= CAPACITY, ETL_ERROR(vector_full));
initialise();
p_end = etl::fill_n(p_buffer, n, value);
}
//*************************************************************************
/// Clears the vector.
//*************************************************************************
void clear()
{
initialise();
}
//*********************************************************************
/// Inserts a value at the end of the vector.
/// If asserts or exceptions are enabled, emits vector_full if the vector is already full.
///\param value The value to add.
//*********************************************************************
void push_back(value_type value)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT_OR_RETURN(size() != CAPACITY, ETL_ERROR(vector_full));
#endif
*p_end++ = value;
}
//*********************************************************************
/// Emplaces a value at the end of the vector.
/// If asserts or exceptions are enabled, emits vector_full if the vector is already full.
///\param value The value to add.
//*********************************************************************
void emplace_back(value_type value)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT_OR_RETURN(size() != CAPACITY, ETL_ERROR(vector_full));
#endif
* p_end++ = value;
}
//*************************************************************************
/// Removes an element from the end of the vector.
/// Does nothing if the vector is empty.
//*************************************************************************
void pop_back()
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT_OR_RETURN(size() > 0, ETL_ERROR(vector_empty));
#endif
--p_end;
}
//*********************************************************************
/// Inserts a value to the vector.
/// If asserts or exceptions are enabled, emits vector_full if the vector is already full.
///\param position The position to insert before.
///\param value The value to insert.
//*********************************************************************
#if defined(ETL_COMPILER_GCC) && defined(ETL_IN_UNIT_TEST)
#include "diagnostic_array_bounds_push.h"
#endif
iterator insert(const_iterator position, value_type value)
{
ETL_ASSERT(size() != CAPACITY, ETL_ERROR(vector_full));
iterator position_ = to_iterator(position);
if (size() != CAPACITY)
{
if (position_ != end())
{
++p_end;
etl::copy_backward(position_, end() - 1, end());
*position_ = value;
}
else
{
*p_end++ = value;
}
}
return position_;
}
#if defined(ETL_COMPILER_GCC) && defined(ETL_IN_UNIT_TEST)
#include "diagnostic_pop.h"
#endif
//*************************************************************************
/// Emplaces a value to the vector at the specified position.
/// If asserts or exceptions are enabled, emits vector_full if the vector is already full.
//*************************************************************************
#if defined(ETL_COMPILER_GCC) && defined(ETL_IN_UNIT_TEST)
#include "diagnostic_array_bounds_push.h"
#endif
iterator emplace(const_iterator position)
{
ETL_ASSERT(size() != CAPACITY, ETL_ERROR(vector_full));
iterator position_ = to_iterator(position);
if (position_ != end())
{
++p_end;
etl::copy_backward(position_, end() - 1, end());
*position_ = ETL_NULLPTR;
}
else
{
*p_end++ = ETL_NULLPTR;
}
return position_;
}
#if defined(ETL_COMPILER_GCC) && defined(ETL_IN_UNIT_TEST)
#include "diagnostic_pop.h"
#endif
//*************************************************************************
/// Emplaces a value to the vector at the specified position.
/// If asserts or exceptions are enabled, emits vector_full if the vector is already full.
//*************************************************************************
#if defined(ETL_COMPILER_GCC) && defined(ETL_IN_UNIT_TEST)
#include "diagnostic_array_bounds_push.h"
#endif
iterator emplace(const_iterator position, value_type value)
{
ETL_ASSERT(size() != CAPACITY, ETL_ERROR(vector_full));
iterator position_ = to_iterator(position);
if (position_ != end())
{
++p_end;
etl::copy_backward(position_, end() - 1, end());
*position_ = value;
}
else
{
*p_end++ = value;
}
return position_;
}
#if defined(ETL_COMPILER_GCC) && defined(ETL_IN_UNIT_TEST)
#include "diagnostic_pop.h"
#endif
//*********************************************************************
/// Inserts 'n' values to the vector.
/// If asserts or exceptions are enabled, emits vector_full if the vector does not have enough free space.
///\param position The position to insert before.
///\param n The number of elements to add.
///\param value The value to insert.
//*********************************************************************
#if defined(ETL_COMPILER_GCC) && defined(ETL_IN_UNIT_TEST)
#include "diagnostic_array_bounds_push.h"
#endif
void insert(const_iterator position, size_t n, value_type value)
{
ETL_ASSERT_OR_RETURN((size() + n) <= CAPACITY, ETL_ERROR(vector_full));
iterator position_ = to_iterator(position);
etl::copy_backward(position_, p_end, p_end + n);
etl::fill_n(position_, n, value);
p_end += n;
}
#if defined(ETL_COMPILER_GCC) && defined(ETL_IN_UNIT_TEST)
#include "diagnostic_pop.h"
#endif
//*********************************************************************
/// Inserts a range of values to the vector.
/// If asserts or exceptions are enabled, emits vector_full if the vector does not have enough free space.
/// For fundamental and pointer types.
///\param position The position to insert before.
///\param first The first element to add.
///\param last The last + 1 element to add.
//*********************************************************************
template <typename TIterator>
void insert(const_iterator position, TIterator first, TIterator last)
{
size_t count = etl::distance(first, last);
iterator position_ = to_iterator(position);
ETL_ASSERT_OR_RETURN((size() + count) <= CAPACITY, ETL_ERROR(vector_full));
etl::copy_backward(position_, p_end, p_end + count);
etl::copy(first, last, position_);
p_end += count;
}
//*********************************************************************
/// Erases an element.
///\param i_element Iterator to the element.
///\return An iterator pointing to the element that followed the erased element.
//*********************************************************************
iterator erase(iterator i_element)
{
etl::copy(i_element + 1, end(), i_element);
--p_end;
return i_element;
}
//*********************************************************************
/// Erases an element.
///\param i_element Iterator to the element.
///\return An iterator pointing to the element that followed the erased element.
//*********************************************************************
iterator erase(const_iterator i_element)
{
iterator i_element_ = to_iterator(i_element);
etl::copy(i_element_ + 1, end(), i_element_);
--p_end;
return i_element_;
}
//*********************************************************************
/// Erases a range of elements.
/// The range includes all the elements between first and last, including the
/// element pointed by first, but not the one pointed by last.
///\param first Iterator to the first element.
///\param last Iterator to the last element.
///\return An iterator pointing to the element that followed the erased element.
//*********************************************************************
iterator erase(const_iterator first, const_iterator last)
{
iterator first_ = to_iterator(first);
iterator last_ = to_iterator(last);
etl::copy(last_, end(), first_);
size_t n_delete = static_cast<size_t>(etl::distance(first, last));
// Just adjust the count.
p_end -= n_delete;
return first_;
}
//*************************************************************************
/// Assignment operator.
//*************************************************************************
etl::pvoidvector& operator = (const etl::pvoidvector& rhs)
{
if (&rhs != this)
{
this->initialise();
this->resize(rhs.size());
etl::copy_n(rhs.data(), rhs.size(), this->data());
}
return *this;
}
#if ETL_USING_CPP11
//*************************************************************************
/// Move assignment operator.
//*************************************************************************
etl::pvoidvector& operator = (etl::pvoidvector&& rhs)
{
if (&rhs != this)
{
this->initialise();
this->resize(rhs.size());
etl::copy_n(rhs.data(), rhs.size(), this->data());
rhs.initialise();
}
return *this;
}
#endif
//*************************************************************************
/// Gets the current size of the vector.
///\return The current size of the vector.
//*************************************************************************
size_type size() const
{
return size_t(p_end - p_buffer);
}
//*************************************************************************
/// Checks the 'empty' state of the vector.
///\return <b>true</b> if empty.
//*************************************************************************
bool empty() const
{
return (p_end == p_buffer);
}
//*************************************************************************
/// Checks the 'full' state of the vector.
///\return <b>true</b> if full.
//*************************************************************************
bool full() const
{
return size() == CAPACITY;
}
//*************************************************************************
/// Returns the remaining capacity.
///\return The remaining capacity.
//*************************************************************************
size_t available() const
{
return max_size() - size();
}
protected:
//*********************************************************************
/// Constructor.
//*********************************************************************
pvoidvector(void** p_buffer_, size_t MAX_SIZE)
: vector_base(MAX_SIZE)
, p_buffer(p_buffer_)
, p_end(p_buffer_)
{
}
//*********************************************************************
/// Initialise the vector.
//*********************************************************************
void initialise()
{
p_end = p_buffer;
}
//*************************************************************************
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
void repair_buffer(void** p_buffer_)
{
uintptr_t length = static_cast<uintptr_t>(p_end - p_buffer);
p_buffer = p_buffer_;
p_end = p_buffer_ + length;
}
void** p_buffer;
void** p_end;
private:
//*************************************************************************
/// Convert from const_iterator to iterator
//*************************************************************************
iterator to_iterator(const_iterator itr) const
{
return const_cast<iterator>(itr);
}
// Disable copy construction.
pvoidvector(const pvoidvector&);
};
//***************************************************************************
/// Equal operator.
///\param lhs Reference to the first vector.
///\param rhs Reference to the second vector.
///\return <b>true</b> if the arrays are equal, otherwise <b>false</b>
///\ingroup vector
//***************************************************************************
inline bool operator ==(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs)
{
return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************
/// Not equal operator.
///\param lhs Reference to the first vector.
///\param rhs Reference to the second vector.
///\return <b>true</b> if the arrays are not equal, otherwise <b>false</b>
///\ingroup vector
//***************************************************************************
inline bool operator !=(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs)
{
return !(lhs == rhs);
}
//***************************************************************************
/// Less than operator.
///\param lhs Reference to the first vector.
///\param rhs Reference to the second vector.
///\return <b>true</b> if the first vector is lexicographically less than the second, otherwise <b>false</b>
///\ingroup vector
//***************************************************************************
inline bool operator <(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs)
{
return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
}
//***************************************************************************
/// Greater than operator.
///\param lhs Reference to the first vector.
///\param rhs Reference to the second vector.
///\return <b>true</b> if the first vector is lexicographically greater than the second, otherwise <b>false</b>
///\ingroup vector
//***************************************************************************
inline bool operator >(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs)
{
return (rhs < lhs);
}
//***************************************************************************
/// Less than or equal operator.
///\param lhs Reference to the first vector.
///\param rhs Reference to the second vector.
///\return <b>true</b> if the first vector is lexicographically less than or equal to the second, otherwise <b>false</b>
///\ingroup vector
//***************************************************************************
inline bool operator <=(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs)
{
return !(lhs > rhs);
}
//***************************************************************************
/// Greater than or equal operator.
///\param lhs Reference to the first vector.
///\param rhs Reference to the second vector.
///\return <b>true</b> if the first vector is lexicographically greater than or equal to the second, otherwise <b>false</b>
///\ingroup vector
//***************************************************************************
inline bool operator >=(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs)
{
return !(lhs < rhs);
}
}
#include "minmax_pop.h"
#undef ETL_IN_PVOIDVECTOR
#endif
|