[PATCH] Include explicit instantiations of iostream inserters and extractors in string.cpp.

Peter Collingbourne peter at pcc.me.uk
Sat Sep 21 15:59:59 PDT 2013


On Sat, Sep 21, 2013 at 05:23:18PM -0400, Howard Hinnant wrote:
> Can you show a conforming example that demonstrates this problem?  My thinking has been that there is no way to use these functions in a conforming manner wtih including <{i,o}stream>.

This is what I had in mind:

TU1:
========================================================================
#include <iosfwd>
#include <string>

void f(std::ostream &os, const std::string &s) {
  os << s;
}
========================================================================

TU2:
========================================================================
#include <iostream>
#include <string>

using namespace std;

void f(ostream &os, const string &s);

int main() {
  f(cout, "hello world");
}
========================================================================

I believe this is conforming, but I may be mistaken.

Thanks,
-- 
Peter



More information about the cfe-commits mailing list