Instantiate templates in their enclosing namespace

This commit is contained in:
Danny Robson 2012-06-13 14:41:53 +10:00
parent c6106b0f53
commit 4fa7789786
4 changed files with 59 additions and 28 deletions

View File

@ -120,9 +120,14 @@ value<L>::eval (double x, double y) const {
y_fac);
}
template struct value<lerp::linear>;
template struct value<lerp::cubic>;
template struct value<lerp::quintic>;
namespace util {
namespace noise {
template struct value<lerp::linear>;
template struct value<lerp::cubic>;
template struct value<lerp::quintic>;
}
}
///////////////////////////////////////////////////////////////////////////////
@ -175,9 +180,14 @@ gradient<L>::eval (double x, double y) const {
y_fac);
}
template struct gradient<lerp::linear>;
template struct gradient<lerp::cubic>;
template struct gradient<lerp::quintic>;
namespace util {
namespace noise {
template struct gradient<lerp::linear>;
template struct gradient<lerp::cubic>;
template struct gradient<lerp::quintic>;
}
}
///////////////////////////////////////////////////////////////////////////////

View File

@ -1,3 +1,23 @@
/*
* This file is part of libgim.
*
* libgim is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* libgim is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License
* along with libgim. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2011-2012 Danny Robson <danny@nerdcruft.net>
*/
#include "range.hpp"
#include "debug.hpp"
@ -7,15 +27,12 @@
#include <cstdint>
//-----------------------------------------------------------------------------
using namespace std;
using namespace util;
/*
* Range
*/
//-----------------------------------------------------------------------------
template <typename T>
range<T>::range (const json::node &node) {
if (node.is_string () && (node == "UNIT" ||
@ -170,9 +187,11 @@ const range<T>
range<T>::UNIT (0.0, 1.0);
template struct range<double>;
template struct range<float>;
template struct range<uint8_t>;
template struct range<uint16_t>;
template struct range<uint32_t>;
template struct range<uint64_t>;
namespace util {
template struct range<double>;
template struct range<float>;
template struct range<uint8_t>;
template struct range<uint16_t>;
template struct range<uint32_t>;
template struct range<uint64_t>;
}

View File

@ -163,12 +163,13 @@ operator<< (std::ostream &os, const region<T> &rhs) {
}
template struct region<int32_t>;
template struct region<int64_t>;
template struct region<uint32_t>;
template struct region<uint64_t>;
template struct region<double>;
template std::ostream& operator<< (std::ostream&, const region<unsigned int>&);
template std::ostream& operator<< (std::ostream&, const region<double>&);
namespace util {
template struct region<int32_t>;
template struct region<int64_t>;
template struct region<uint32_t>;
template struct region<uint64_t>;
template struct region<double>;
template std::ostream& operator<< (std::ostream&, const region<unsigned int>&);
template std::ostream& operator<< (std::ostream&, const region<double>&);
}

View File

@ -60,10 +60,11 @@ namespace util {
void sanity (void) const;
};
template <typename T>
std::ostream& operator<< (std::ostream&, const util::region<T>&);
}
template <typename T>
std::ostream&
operator<< (std::ostream&, const util::region<T>&);
#endif