std::experi...th::concat,(3)
π
std::experi...th::concat,(3) π
okay bestie, welcome to the C++ Standard Libary manual page for std::experimental::filesystem::path::concat β yes, the header spells it C++ Standard Libary, and yes, Iβm keeping it exactly like that. This whole page is filesystem TS energy, so every overload below is tagged that way. Letβs go, no cap. β¨
πΈ NAME πΈ
std::experimental::filesystem::path::concat,β the NAME block literally listsstd::experimental::filesystem::path::concat, -and thenstd::experimental::filesystem::path::concat,again. Itβs giving βconcat page, concat title, concat everythingβ, periodt.
β¨ Synopsis β¨
path& operator+=( const path& p ); (1)
(filesystem TS)
path& operator+=( const string_type& str ); (2)
(filesystem TS)
path& operator+=( const value_type* ptr ); (3)
(filesystem TS)
path& operator+=( value_type x ); (4)
(filesystem TS)
template< class Source > (5)
(filesystem TS)
path& operator+=( const Source& source );
template< class CharT > (6)
(filesystem TS)
path& operator+=( CharT x );
template< class Source > (7)
(filesystem TS)
path& concat( const Source& source );
template< class InputIt > (8)
(filesystem TS)
path& concat( InputIterator first, InputIterator last );
Concatenates the current path and the argument. π«Ά
- Concatenates
*thisandpin such a way thatnative()of the result is exactly originalnative()concatenated withp.native(). - Same as (1), except the resulting
native()is a concatenation of the originalnative()and the stringstr. - Same as (1), except the resulting
native()is a concatenation of the originalnative()and the null-terminated string whose first character is pointed to byptr. - Same as (1), except the resulting
native()is a concatenation of the originalnative()and the single characterx. - Same as (1), except the resulting
native()is a concatenation of the originalnative()and the sequence (which may be in portable or native format) represented bysource, which may bestd::basic_string, null-terminated multicharacter string, or an input iterator pointing to a null-terminated multicharacter sequence. - Same as (4), except that character conversion may be performed.
- Same as (5).
- Same as (5), except that the sequence is represented by any iterator pair that designates a multicharacter string.
π Parameters π
pβ path to append.strβ string to append.ptrβ pointer to the beginning of a null-terminated string to append.xβ single character to append.sourceβstd::basic_string, null-terminated multicharacter string, or an input iterator pointing to a null-terminated multicharacter sequence, which represents a path name (either in portable or in native format).first,lastβ pair ofLegacyInputIteratorsthat specify a multicharacter sequence that represents a path name.
π§ Type requirements π§
InputItmust meet the requirements ofLegacyInputIterator.- The value type of
InputItmust be one of the encoded character types (char,wchar_t,char16_tandchar32_t). CharTmust be one of the encoded character types (char,wchar_t,char16_tandchar32_t).
π Return value π
*this β thatβs the whole return value, bestie. Iconic. π
π Exceptions π
May throw filesystem_error on underlying OS API errors or std::bad_alloc if memory allocation fails. So yeah, keep an eye out. π
π¦ Notes π¦
Unlike with append() or operator/=, additional directory separators are never introduced. Thatβs the whole vibe: concat does not sneak a / in there. Periodt. π₯
π Example π
// Run this code
#include <experimental/filesystem>
#include <iostream>
namespace fs = std::experimental::filesystem;
int main()
{
fs::path p1; // empty path
p1 += "var"; // does not insert a separator
std::cout << "\"\" + \"var\" == " << p1 << '\n';
p1 += "lib"; // does not insert a separator
std::cout << "\"\" + \"var\" + \"lib\" == " << p1 << '\n';
}
π Output π
"" + "var" == "var"
"" + "var" + "lib" == "varlib"
π See also π
appendβ appends elements to the path.operator/=β (public member function).operator/β concatenates two paths with a directory separator (function).
π·οΈ Category π·οΈ
* Noindexed pages
π«Ά thatβs the whole page, bestie. Footer check: source is http://cppreference.com, version/date is 2024.06.10, and the footer repeats std::experi...th::concat,(3). Bye! π
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms