I come from a Java and C# background and as a way to dive into C++, I'm building an icons dock using Qt and Boost. Looking at the documentation for the serialization, I stumbled uppon some interesting use of an & operator.
class gps_position
{
private:
friend class boost::serialization::access;
// When the class Archive corresponds to an output archive, the
// & operator is defined similar to <<. Likewise, when the class Archive
// is a type of input archive the & operator is defined similar to >>.
template<class Archive>
void serialize(Archive & ar, const unsigned int version)
{
ar & degrees;
ar & minutes;
ar & seconds;
}
int degrees;
int minutes;
float seconds;
The purpose of the & operator is very clear reading the comments. What I'd like to know, is how is it achieved? How does it know what "&" is supposed to mean? I searched for more uses of the ampersand operator on Google, but all I can find is & used in order to denote reference rather than an opperation.
Thanks.