On 2015.02.06. 19:20,
mooingps...@gmail.com wrote:
> You know what feature I would love? A preprocessor statement
> that keeps a block of text unparsed until a certain other file is
included.
> When that other file is included, the unparsed block of memory is
inserted
> just after that file.
>
> myclass.h
>
> #include <string>
> class myclass {
> std::string name;
> };
>
> #when <iostream>
> std::istream& operator>>(std::istream& in, myclass& data)
> {return in>>
data.name;}
> std::ostream& operator<<(std::ostream& in, myclass& data)
> {return in>>
data.name;}
> #endwhen
class std::istream;
class std::ostream;
std::istream& operator>>(std::istream& in, myclass& data);
std::ostream& operator<<(std::ostream& in, myclass& data);
/* implementation in file myclass.cc */
> #when <bignetworking.h>
> #pragma comment(lib,"bignetworking.lib")
> inline HRESULT loadfromxml(myclass& data, const bigxmlblob& blob) {
> //etc
> }
> inline HRESULT savetoxml(myclass& data, bigxmlblob& blob) {
> //etc
> }
> #endwhen
class bigxml;
HRESULT loadfromxml(myclass& data, const bigxmlblob& blob);
HRESULT savetoxml(myclass& data, bigxmlblob& blob);
/* implementation in file myclass.cc */
PS: please don't try to use the 'inline is fast' argument on me;)