I have the following template codes but some normal functions too and want
to group them together.
I usually put the implementation of templates in an .ipp file. What would be a good scheme for the normal functions. Put their implementations in a .cpp file, or leave them in the .ipp file?
#ifndef NUMERIC_HPP
#define NUMERIC_HPP
#include <iostream>
#include <malloc.h>
#include <iomanip>
#include <cstdlib>
#include <string.h>
using namespace std;
template <class T>
inline T
abs
(
T v
);
template <class T>
inline T
sqr
(
const T r
) ;
inline bool
odd
(
int i
) {
return (i & 0x1); // Bitwise AND, (0101 & 0001) returns true.
}
inline bool
even
(
int i
) {
return ( ! (i & 0x1) ); // Bitwise AND, (0101 & 0001) returns true.
}
inline long int
mem
(
);
inline void
randomize
(
);
inline float
rand
(
const float max
);
inline int
rand
(
const int max
);
#include "tomso/numeric/impl/numeric.ipp"
#endif