fixed: operator==() and operator!=() in iterators in MemBuffer<> template

did not have 'const' modifier and there was an error when compiling with clang with -std=c++20 flag

/usr/home/tomek/roboczy/prog/web.ttmath.org/../pikotools/textstream/textstream.h:225:11: fatal error: use of overloaded operator '!=' is ambiguous (with operand types
      'PT::TextStreamBase<char, 256, 4096>::const_iterator' (aka 'PT::MemBuffer<char, 256, 4096>::const_iterator') and 'PT::TextStreamBase<char, 256, 4096>::const_iterator')
        for( ; i != end() ; ++i)
               ~ ^  ~~~~~
/usr/home/tomek/roboczy/prog/web.ttmath.org/../morm/src/finderhelper.h:78:14: note: in instantiation of member function 'PT::TextStreamBase<char, 256, 4096>::to_string' requested here
                table_name.to_string(table_name_str);
                           ^
/usr/home/tomek/roboczy/prog/web.ttmath.org/../pikotools/membuffer/membuffer.h:93:8: note: candidate function
                bool operator!=(const const_iterator & i);
                     ^
/usr/home/tomek/roboczy/prog/web.ttmath.org/../pikotools/membuffer/membuffer.h:92:8: note: candidate function
                bool operator==(const const_iterator & i);
                     ^
/usr/home/tomek/roboczy/prog/web.ttmath.org/../pikotools/membuffer/membuffer.h:92:8: note: candidate function (with reversed parameter order)
This commit is contained in:
Tomasz Sowa 2021-02-17 16:53:19 +01:00
parent aff698d155
commit 49e49d1246
1 changed files with 9 additions and 9 deletions

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2012-2013, Tomasz Sowa
* Copyright (c) 2012-2021, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -58,8 +58,8 @@ public:
{
public:
bool operator==(const iterator & i);
bool operator!=(const iterator & i);
bool operator==(const iterator & i) const;
bool operator!=(const iterator & i) const;
iterator & operator++(); // prefix ++
iterator operator++(int); // postfix ++
@ -89,8 +89,8 @@ public:
const_iterator & operator=(const const_iterator & i);
const_iterator & operator=(const iterator & i);
bool operator==(const const_iterator & i);
bool operator!=(const const_iterator & i);
bool operator==(const const_iterator & i) const;
bool operator!=(const const_iterator & i) const;
const_iterator & operator++(); // prefix ++
const_iterator operator++(int); // postfix ++
@ -264,7 +264,7 @@ item_type & MemBuffer<item_type, stack_size, heap_block_size>::iterator::operato
template<typename item_type, size_t stack_size, size_t heap_block_size>
bool MemBuffer<item_type, stack_size, heap_block_size>::iterator::operator==(const iterator & i)
bool MemBuffer<item_type, stack_size, heap_block_size>::iterator::operator==(const iterator & i) const
{
return mem_buffer == i.mem_buffer &&
dynamic_array_index == i.dynamic_array_index &&
@ -273,7 +273,7 @@ bool MemBuffer<item_type, stack_size, heap_block_size>::iterator::operator==(con
template<typename item_type, size_t stack_size, size_t heap_block_size>
bool MemBuffer<item_type, stack_size, heap_block_size>::iterator::operator!=(const iterator & i)
bool MemBuffer<item_type, stack_size, heap_block_size>::iterator::operator!=(const iterator & i) const
{
return mem_buffer != i.mem_buffer ||
dynamic_array_index != i.dynamic_array_index ||
@ -422,7 +422,7 @@ item_type MemBuffer<item_type, stack_size, heap_block_size>::const_iterator::ope
template<typename item_type, size_t stack_size, size_t heap_block_size>
bool MemBuffer<item_type, stack_size, heap_block_size>::const_iterator::operator==(const const_iterator & i)
bool MemBuffer<item_type, stack_size, heap_block_size>::const_iterator::operator==(const const_iterator & i) const
{
return mem_buffer == i.mem_buffer &&
dynamic_array_index == i.dynamic_array_index &&
@ -431,7 +431,7 @@ bool MemBuffer<item_type, stack_size, heap_block_size>::const_iterator::operator
template<typename item_type, size_t stack_size, size_t heap_block_size>
bool MemBuffer<item_type, stack_size, heap_block_size>::const_iterator::operator!=(const const_iterator & i)
bool MemBuffer<item_type, stack_size, heap_block_size>::const_iterator::operator!=(const const_iterator & i) const
{
return mem_buffer != i.mem_buffer ||
dynamic_array_index != i.dynamic_array_index ||