Ignore:
Timestamp:
Jan 16, 2024, 5:30:58 PM (5 months ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
master
Children:
06280ad
Parents:
739495a
Message:

Add missing test for string *= and refactor */*= to follow +/+= pattern with string_res.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/collections/string.cfa

    r739495a r38951c31  
    236236// Repetition
    237237
     238void ?*=?(string & s, size_t factor) {
     239    (*s.inner) *= factor;
     240}
     241
    238242string ?*?(const string & s, size_t factor) {
    239     string ret = "";
    240     for (factor) ret += s;
    241     return ret;
    242 }
    243 
    244 void ?*=?(string & s, size_t factor) {
    245     s = s * factor;
     243    string ret = s;
     244    ret *= factor;
     245    return ret;
    246246}
    247247
    248248string ?*?(char c, size_t factor) {
    249249    string ret = c;
    250     return ret * factor;
     250    ret *= factor;
     251    return ret;
    251252}
    252253
    253254string ?*?(const char * s, size_t factor) {
    254255    string ret = s;
    255     return ret * factor;
     256    ret *= factor;
     257    return ret;
    256258}
    257259
Note: See TracChangeset for help on using the changeset viewer.