title: Why does std::filesystem::path::append replace the current path if p starts with root path
body: <p>Given below code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;filesystem&gt;
  
  namespace fs = std::filesystem;
  
  int main()
  {
      fs::path fsBase = "/base";
      fs::path fsAppend = "/append";
      auto fsResult = fsBase / fsAppend;
  
      std::cout &lt;&lt; "fsResult: " &lt;&lt; fsResult &lt;&lt; std::endl;
      return 0;
  }
  </code></pre>
  
  <p>Usually, the expected result is <code>/base/append</code>, but it actually gives <code>/append</code>.</p>
  
  <p>The description of <a href="https://en.cppreference.com/w/cpp/filesystem/path/append" rel="noreferrer">fs::path::append</a> does indicate this behavior:</p>
  
  <blockquote>
    <p>If p.is_absolute() || (p.has_root_name() &amp;&amp; p.root_name() != root_name()), then replaces the current path with p as if by operator=(p) and finishes.</p>
  </blockquote>
  
  <p>However, the behavior of <code>std::experimental::filesystem</code> and <code>boost::filesystem</code> is different, that gives expected <code>/base/append</code>.
  See <a href="http://coliru.stacked-crooked.com/a/c56ef67c88ce8b08" rel="noreferrer">examples</a>.</p>
  
  <p>The question is why it behaves like this? Why does it replace the path with <code>append()</code> function?</p>