
Propagate the refactor in Step 10 MathFunctions through all of the steps. Use MathFunctions/MathFunctions.cxx instead of Tutorial.cxx to determine which sqrt library is called. Adds .h files which correspond to their .cxx files by name.
20 lines
275 B
C++
20 lines
275 B
C++
#include "MathFunctions.h"
|
|
|
|
#include <cmath>
|
|
|
|
#ifdef USE_MYMATH
|
|
# include "mysqrt.h"
|
|
#endif
|
|
|
|
namespace mathfunctions {
|
|
double sqrt(double x)
|
|
{
|
|
// which square root function should we use?
|
|
#ifdef USE_MYMATH
|
|
return detail::mysqrt(x);
|
|
#else
|
|
return std::sqrt(x);
|
|
#endif
|
|
}
|
|
}
|