From 781e2b1ea9411e3a9b9a20e7d8fe8bfc025076d7 Mon Sep 17 00:00:00 2001 From: Dominik Thoennes <dominik.thoennes@fau.de> Date: Wed, 24 Jun 2020 10:59:13 +0200 Subject: [PATCH] show usage of extern --- explicit-templates/Hund.cpp | 7 +------ explicit-templates/Hund.hpp | 9 ++++++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/explicit-templates/Hund.cpp b/explicit-templates/Hund.cpp index b7cc17d..d6b23e5 100644 --- a/explicit-templates/Hund.cpp +++ b/explicit-templates/Hund.cpp @@ -6,12 +6,7 @@ void Hund<FOO>::bar(){ bellen<FOO>(); } -template< class FOO> -void bellen(){ - std::cout << "wuff" << std::endl; -} - template class Hund<double>; -//template void bellen<double>(); +template void bellen<double>(); diff --git a/explicit-templates/Hund.hpp b/explicit-templates/Hund.hpp index fc6f016..76ffe87 100644 --- a/explicit-templates/Hund.hpp +++ b/explicit-templates/Hund.hpp @@ -1,4 +1,5 @@ #pragma once +#include <iostream> template< class FOO> class Hund { @@ -6,7 +7,9 @@ class Hund { void bar(); }; -template <class FOO> -void bellen(); +template< class FOO> +void bellen(){ + std::cout << "wuff" << std::endl; +} -//extern template void bellen<double>(); \ No newline at end of file +extern template void bellen<double>(); \ No newline at end of file -- GitLab