src/string.h

changeset 125
85814c0918c5
parent 124
a7b769a0e537
child 128
186ebeea2a85
equal deleted inserted replaced
124:a7b769a0e537 125:85814c0918c5
322 inline operator const StringType&() const 322 inline operator const StringType&() const
323 { 323 {
324 return stdString(); 324 return stdString();
325 } 325 }
326 326
327 // ============================================================================= 327 void modifyIndex (int& a)
328 // 328 {
329 // Difference between indices @a and @b. @b can be -1, in which 329 if (a < 0)
330 // case it will be length() - 1. 330 a = length() - a;
331 // 331 }
332 inline int indexDifference (int a, int b) 332
333 { 333 int indexDifference (int a, int b)
334 assert (b == -1 || b >= a); 334 {
335 return (b != -1 ? b - a : length() - 1 - a); 335 modifyIndex (a);
336 modifyIndex (b);
337 return b - a;
336 } 338 }
337 339
338 private: 340 private:
339 StringType m_string; 341 StringType m_string;
340 }; 342 };

mercurial