C Programming Column
by Al Stevens


Example 1:

#ifndef DOIT_H

export template <class T>
void doit(const T* ar);

#endif


Example 2:

#include <iostream>
#include "doit.h"
export template <class T>
void doit(const T* ar)
{
    for (int i = 0; ar[i] != 0; i++)
        std::cout << ar[i] << ' ';
    std::cout << std::endl;
}


Example 3:

#include "doit.h"
int main()
{
    int intarray[] = { 1, 2, 3, 4, 0 };
    float floatarray[] = { 1.2, 2.3, 3.4, 0.0 };
    doit(intarray);
    doit(floatarray);
    return 0;
}






1


