@@ -1860,20 +1860,12 @@ namespace pcs // i.e. "pythonic c++ strings"
18601860// --- iterating -----------------------------------
18611861inline const IntTbegin (const CppString& str)noexcept // !< starts iterating on specified CppString.
18621862 {
1863- if (_start == DEFAULT)
1864- _start =0 ;
1865- else if (_start <0 )
1866- _start += str.size ();
1867-
1868- if (_stop == DEFAULT)
1869- _stop = str.size ();
1870- else if (_stop <0 )
1871- _stop += str.size ();
1872-
1873- if (_step == DEFAULT)
1874- _step =1 ;
1863+ return _prepare_iterating (IntT (str.size ()));
1864+ }
18751865
1876- return _index = _start;
1866+ inline const IntTbegin (const CppWString& wstr)noexcept // !< starts iterating on specified CppWString.
1867+ {
1868+ return _prepare_iterating (IntT (wstr.size ()));
18771869 }
18781870
18791871inline const bool end ()const noexcept // !< returns true when iterating is over, or false otherwise.
@@ -1899,6 +1891,24 @@ namespace pcs // i.e. "pythonic c++ strings"
18991891 IntT _step{1 };
19001892
19011893 IntT _index{0 };
1894+
1895+ const IntT_prepare_iterating (const IntT str_size)noexcept
1896+ {
1897+ if (_start == DEFAULT)
1898+ _start =0 ;
1899+ else if (_start <0 )
1900+ _start += str_size;
1901+
1902+ if (_stop == DEFAULT)
1903+ _stop = str_size;
1904+ else if (_stop <0 )
1905+ _stop += str_size;
1906+
1907+ if (_step == DEFAULT)
1908+ _step =1 ;
1909+
1910+ return _index = _start;
1911+ }
19021912 };
19031913
19041914