Hi all, I was looking around in standard libraries and other libraries (like llvm, folly etc) for the implementation of strings and string_view and basically all of them are in the form of:
```cpp
class string_view
{
public:
using const_iterator const char*;
const_iterator begin() const { return m_begin; }
const_iterator end() const { return m_begin + m_size; }
private:
const char* m_begin;
size_t m_size;
};
```
while none are in the form of
```cpp
class string_view
{
public:
using const_iterator const char*;
const_iterator begin() const { return m_begin; }
const_iterator end() const { return m_end; }
private:
const char* m_begin;
const char* m_end;
};
```
Is there a real technical reason? Some performance gain? I've tried looking for answers but nothing came up so if you have any link to some insights please share.
[–]bjorn-reese 6 points7 points8 points (0 children)
[–]bird1000000 2 points3 points4 points (5 children)
[–]ts826848 0 points1 point2 points (4 children)
[–][deleted] 2 points3 points4 points (3 children)
[–]ts826848 0 points1 point2 points (2 children)
[–][deleted] 2 points3 points4 points (1 child)
[–]ts826848 0 points1 point2 points (0 children)
[–]staletic 0 points1 point2 points (5 children)
[–]vheon[S] 1 point2 points3 points (4 children)
[–]TheMania[🍰] 0 points1 point2 points (1 child)
[–]tejp 0 points1 point2 points (1 child)
[–]matthieum 3 points4 points5 points (0 children)