Reputation: 19195
I'm defining a struct as follows:
struct memory_dump {
filesystem::path path;
boost::iostreams::mapped_file_source mapped_file;
memory_dump_type type;
long long int offset;
};
However, gcc
generates the following warning:
warning: implicitly-declared ‘boost::iostreams::mapped_file_source& boost::iostreams::mapped_file_source::operator=(const boost::iostreams::mapped_file_source&)’ is deprecated [-Wdeprecated-copy]
39 | struct memory_dump {
| ^~~~~~~~~~~
This warning only occurred after upgrading my Boost
version from 1.62.0
or so to 1.72.0
. I resarched the warning but I didn't find any information about this particular Boost
class, why the warning is generated and how to fix it. My goal is to store an instance of the mapped_file_source
so I can access the contents of a memory mapped file efficiently.
Upvotes: 0
Views: 395
Reputation: 729
As you can se here: https://en.cppreference.com/w/cpp/language/copy_assignment
The generation of the implicitly-defined copy assignment operator is deprecated(since C++11) if T has a user-declared destructor or user-declared copy constructor.
Which is the case in boost 1.72, as you can see:
// Copy Constructor
mapped_file_source(const mapped_file_source& other);
There is this copy constructor on line 187 of boost\iostreams\device\mapped_file.hpp
Upvotes: 1