Basically this is a question about semantics. I'm using Cereal library for (de)serialization in C++, and found its coding style interesting:
cereal::PortableBinaryInputArchive ar(instream);
int out;
ar(out);
// int is successfully deserialized from input stream here.
The tricky part is that I do not pass in the "out" by reference and ar() can still modify its value. Well in fact, the author just overrides the operator "()". And I found the corresponding lines in the source files.
OutputArchive & operator=( OutputArchive const & ) = delete;
//! Serializes all passed in data
/*! This is the primary interface for serializing data with an archive */
template <class ... Types> inline
ArchiveType & operator()( Types && ... args )
{
self->process( std::forward<Types>( args )... );
return *self;
}
I'm quite at a loss, especially the first line ("= delete") and things regarding "std::forward( args )...". I only saw some cases in which macros like va_arg are used and it's the first time that I've encountered something like this. Besides, what does "&&" stand for? Could anyone throw some light upon it?