C++ Logo

std-proposals

Advanced search

[std-proposals] Consider:

From: Abdullah Qasim <iamminecraftredstoner_at_[hidden]>
Date: Wed, 20 Apr 2022 10:13:27 +0000
// A very common scenario:
// 100% backward-compatible!

constexpr std::basic_string<CharT, Traits, Allocator>::replace(const char* const dest, const char* const src)
{
          this->replace(this->find(dest), std::strlen(dest), src);
          return *this; // optional
} // Also make similar functions for C-Strings, & // prototypes to accept strings in header


// Would be very useful, as it is pretty much day-to-day:
// 100% Backward Compatible, given that ios::array & //ios::separator (both new) are, by default,
// false & ‘,’ respectively

std::ostream& operator<<(const auto array[])
{
          if (std::ios::array) {
                   this->operator<<(array); // Print Memory Loc.
                   return *this;
          }

for (auto& array : int i{}) {
                   this->operator<<(array[i]); // Output
                   this->operator<<(std::ios::seperator); //
          }

          return *this;
}



Received on 2022-04-20 10:13:30