diff --git a/src/hello_world.cc b/src/hello_world.cc new file mode 100644 index 0000000..0b4df22 --- /dev/null +++ b/src/hello_world.cc @@ -0,0 +1,29 @@ +// This file is under GNU General Public License 3.0 +// see LICENSE.txt + +#include "hello_world.hh" + +namespace pEp { + namespace HelloWorld { + //non-template func and template-specializations here + std::string hello_world() + { + return "hello world"; + } + + // specialization for int + template<> + int hello_world(int param1) + { + return param1 * 2; + } + + // specialization for float + template<> + double hello_world(double param1) + { + return param1 * 2; + } + + } // namespace HelloWorld +} // namespace pEp diff --git a/src/hello_world.hh b/src/hello_world.hh new file mode 100644 index 0000000..1dddb3f --- /dev/null +++ b/src/hello_world.hh @@ -0,0 +1,24 @@ +// This file is under GNU General Public License 3.0 +// see LICENSE.txt + +#ifndef LIBPEPHELLOWORLD_HELLO_WORLD_HH +#define LIBPEPHELLOWORLD_HELLO_WORLD_HH + +#include + +namespace pEp { + namespace HelloWorld { + // non-template functions and classes + // impl in .cc + std::string hello_world(); + + // template functions and classes + // impl in .hxx + template + T hello_world(T param1); + } // namespace HelloWorld +} // namespace pEp + +#include "hello_world.hxx" + +#endif // LIBPEPHELLOWORLD_HELLO_WORLD_HH diff --git a/src/hello_world.hxx b/src/hello_world.hxx new file mode 100644 index 0000000..55a82c6 --- /dev/null +++ b/src/hello_world.hxx @@ -0,0 +1,19 @@ +// This file is under GNU General Public License 3.0 +// see LICENSE.txt + +#ifndef LIBPEPHELLOWORLD_HELLO_WORLD_HXX +#define LIBPEPHELLOWORLD_HELLO_WORLD_HXX + +#include + +namespace pEp { + namespace HelloWorld { + template + T hello_world(T param1) + { + return param1; + } + } // namespace HelloWorld +} // namespace pEp + +#endif //LIBPEPHELLOWORLD_HELLO_WORLD_HXX