You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
inlineconst IntToperator++()noexcept//!< iterates one step, pre-increment. Caution:returnedindex may be out of bounds. Check '!end()' beforeusing its value.
1874
+
inlineSliceoperator++()noexcept//!< iterates one step, pre-increment. Caution: index may be out of bounds. Check '!end()' beforedereferencing the slice.
1877
1875
{
1878
-
return _index += _step;
1876
+
_index += _step;
1877
+
return *this;
1879
1878
}
1880
1879
1881
-
inlineconst IntToperator++(int)noexcept//!< iterates one step, post-increment. Caution:returnedindex may be out of bounds. Check '!end()' beforeusing its value.
1880
+
inlineSliceoperator++(int)noexcept//!< iterates one step, post-increment. Caution: index may be out of bounds. Check '!end()' beforedereferencing the slice.
1882
1881
{
1883
1882
_index += _step;
1884
-
return _index - _step;
1883
+
return *this;
1884
+
}
1885
+
1886
+
inlineconst IntToperator*()noexcept//!< dereferences the slice.
1887
+
{
1888
+
return _index;
1885
1889
}
1886
1890
1887
1891
@@ -1896,16 +1900,38 @@ namespace pcs // i.e. "pythonic c++ strings"
1896
1900
{
1897
1901
if (_start == DEFAULT)
1898
1902
_start =0;
1899
-
elseif (_start <0)
1903
+
elseif (_start <0) {
1900
1904
_start += str_size;
1901
-
1902
-
if (_stop == DEFAULT)
1903
-
_stop = str_size;
1904
-
elseif (_stop <0)
1905
+
if (_start <0)
1906
+
_start =0;
1907
+
}
1908
+
elseif (_start >= str_size)
1909
+
_start = str_size -1;
1910
+
1911
+
if (_stop == DEFAULT) {
1912
+
if (_step <0 && _step != DEFAULT)
1913
+
_stop =0;
1914
+
else
1915
+
_stop = str_size;
1916
+
}
1917
+
elseif (_stop <0) {
1905
1918
_stop += str_size;
1919
+
if (_stop <0)
1920
+
_stop =0;
1921
+
}
1922
+
elseif (_stop > str_size)
1923
+
_stop = str_size;
1906
1924
1907
1925
if (_step == DEFAULT)
1908
1926
_step =1;
1927
+
if (_step <0) {
1928
+
if (_start <= _stop)
1929
+
_step =0;// will force end() to true
1930
+
}
1931
+
else {
1932
+
if (_start >= _stop)
1933
+
_step =0;// will force end() to true
1934
+
}
1909
1935
1910
1936
return _index = _start;
1911
1937
}
@@ -1917,11 +1943,11 @@ namespace pcs // i.e. "pythonic c++ strings"