On cppreference.com I can't find any information about whether std::basic_format_string
defines a copy or move constructor or if these don't exist.
When I look at Microsoft's STL implementation, it looks like the compiler-generated versions are simply available. Is this defined in the C++ standard?
This is one of those cases where you have to go directly to the standard:
template<class charT, class... Args>
struct basic_format_string {
private:
basic_string_view<charT> str; // exposition only
public:
template<class T> consteval basic_format_string(const T& s);
basic_format_string(runtime-format-string<charT> s) noexcept : str(s.str) {}
constexpr basic_string_view<charT> get() const noexcept { return str; }
};
In this definition of basic_format_string
, there is no declared copy constructor, move constructor, copy assignment operator, or move assignment operator, so all of these special member functions are implicitly declared in accordance with the core language rules regarding special member functions. In this case since the only data member is of type basic_string_view<charT>
, all four of the copy/move special member functions will simply copy/move that data member.