std::experimental::filesystem::path::replace_extension
Min standard notice:
Replaces the extension with replacement or removes it when the default value of replacement is used.
# Declarations
path& replace_extension( const path& replacement = path() );
(filesystem TS)
# Parameters
replacement: the extension to replace with
# Return value
*this
# Example
#include <experimental/filesystem>
#include <iostream>
namespace fs = std::experimental::filesystem;
int main()
{
fs::path p = "/foo/bar.jpeg";
std::cout << "Was: " << p << '\n';
p.replace_extension(".jpg");
std::cout << "Now: " << p << '\n';
}