All pastes #2430872 Raw Edit

Something

public unlisted cpp v1 · immutable
#2430872 ·published 2013-08-12 04:40 UTC
rendered paste body
#include <adolc/adolc.h>#include <cmath>#include <map>#include <iostream>#include <typeinfo>using namespace std;template<class Real>class wrap{public:  Real x;  wrap(Real x):	x(x){}  Real mul(const wrap<Real> v) const{	return x * v.x;  }};template<class Real>ostream& operator<<(ostream& os, const wrap<Real>& v){  return ( os << "wrap( " << v.x << " )" );}template<class Real>bool test(const wrap<Real> a,const wrap<Real> b){  cout << "   test()" << endl;  cout << "    before: a,b: " << a << ", " << b << endl;  Real A = b.mul(a);  cout << "    after : a,b: " << a << ", " << b << endl;  cout << "    A==" << A << endl;  make_pair(-A, -A);  return true;}#define TEST_ROUTINE {										\	cout << "checking for " << typeid (D).name() << endl;	\	wrap<const D>											\	  a(2), b(3);											\	test(a,b) && test(a,b);									\  }int main(){  {#define D double	TEST_ROUTINE#undef D  }  {#define D adouble	TEST_ROUTINE#undef D  }  return 0;}