[ create a new paste ] login | about

Link: http://codepad.org/76xnAQ7n    [ raw code | output | fork ]

Niels - C++, pasted on Jun 29:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <string>
#include <algorithm>

namespace foo
{
  template<class T1, class T2>
  void swap(T1&, T2&)
  {
    throw "foo::swap is called";
  }
}

int main()
{
  std::string a1[42];
  std::string a2[42];

  using foo::swap;
  swap(a1, a2);
}


Output:
1
2
3
4
In function 'void std::swap(_Tp&, _Tp&) [with _Tp = std::string [42]]':
t.cpp:20:   instantiated from here
Line 97: error: ISO C++ forbids assignment of arrays
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: