• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

    最終更新日時(UTC):
    が更新

    履歴 編集

    function template
    <string>

    std::basic_string::append_range

    template <container-compatible-range<charT> R>
    constexpr void append_range(R&& rg); // C++23
    

    概要

    Rangeの要素を末尾へ追加する。

    効果

    append(basic_string(from_range,forward<R>(rg),get_allocator()));

    #include <iostream>
    #include <string>
    
    int main()
    {
      std::string s = "str";
      const char a[3] = {'i', 'n', 'g'};
    
      // Rangeを末尾に追加
      s.append_range(a);
    
      std::cout << s << std::endl;
    }
    

    出力

    string
    

    関連項目

    名前 説明
    push_back 末尾へ要素追加