Move template in-class function definitions out of class

Keeping them defined in-class caused linker issues with the extern template
declaration in a non-optimized MinGW debug build. Apparently it did not
inline them but instead relied on the extern declaration and expected
them defined somewhere else.
This commit is contained in:
Roland Winklmeier
2018-08-29 16:24:43 +02:00
committed by Klaus Basan
parent 5ac7c224bf
commit 29f464189b
6 changed files with 28 additions and 4 deletions

View File

@@ -41,6 +41,18 @@ namespace BlackMisc
{ {
namespace PhysicalQuantities namespace PhysicalQuantities
{ {
template <class MU, class PQ>
const MU & CPhysicalQuantity<MU, PQ>::getUnit() const
{
return m_unit;
}
template <class MU, class PQ>
void CPhysicalQuantity<MU, PQ>::setUnit(const MU &unit)
{
m_unit = unit;
}
template <class MU, class PQ> template <class MU, class PQ>
void CPhysicalQuantity<MU, PQ>::setUnitBySymbol(const QString &unitName) void CPhysicalQuantity<MU, PQ>::setUnitBySymbol(const QString &unitName)
{ {

View File

@@ -70,11 +70,11 @@ namespace BlackMisc
}; };
//! Unit //! Unit
const MU &getUnit() const { return m_unit; } const MU &getUnit() const;
//! Simply set unit, do no calclulate conversion //! Simply set unit, do no calclulate conversion
//! \sa switchUnit //! \sa switchUnit
void setUnit(const MU &unit) { m_unit = unit; } void setUnit(const MU &unit);
//! Set unit by string //! Set unit by string
void setUnitBySymbol(const QString &unitName); void setUnitBySymbol(const QString &unitName);

View File

@@ -481,6 +481,12 @@ namespace BlackMisc
this->getAndFetchModelCG(); this->getAndFetchModelCG();
} }
template<typename Derived>
void CInterpolator<Derived>::markAsUnitTest()
{
m_unitTest = true;
}
CInterpolationResult::CInterpolationResult() CInterpolationResult::CInterpolationResult()
{ {
this->reset(); this->reset();

View File

@@ -227,7 +227,7 @@ namespace BlackMisc
void initCorrespondingModel(const CAircraftModel &model = {}); void initCorrespondingModel(const CAircraftModel &model = {});
//! Mark as unit test //! Mark as unit test
void markAsUnitTest() { m_unitTest = true; } void markAsUnitTest();
protected: protected:
//! Constructor //! Constructor

View File

@@ -643,6 +643,12 @@ namespace BlackMisc
return dt.isValid() ? dt.toMSecsSinceEpoch() : -1; return dt.isValid() ? dt.toMSecsSinceEpoch() : -1;
} }
template <class OBJ, class CONTAINER>
void ITimestampWithOffsetObjectList<OBJ, CONTAINER>::setAdjustedSortHint(HintAdjustedTimestampSort hint)
{
m_tsAdjustedSortHint = hint;
}
// see here for the reason of thess forward instantiations // see here for the reason of thess forward instantiations
// https://isocpp.org/wiki/faq/templates#separate-template-fn-defn-from-decl // https://isocpp.org/wiki/faq/templates#separate-template-fn-defn-from-decl
template class BLACKMISC_EXPORT_DEFINE_TEMPLATE ITimestampObjectList<BlackMisc::CCountry, BlackMisc::CCountryList>; template class BLACKMISC_EXPORT_DEFINE_TEMPLATE ITimestampObjectList<BlackMisc::CCountry, BlackMisc::CCountryList>;

View File

@@ -251,7 +251,7 @@ namespace BlackMisc
qint64 oldestAdjustedTimestampMsecsSinceEpoch() const; qint64 oldestAdjustedTimestampMsecsSinceEpoch() const;
//! Set the hint //! Set the hint
void setAdjustedSortHint(HintAdjustedTimestampSort hint) { m_tsAdjustedSortHint = hint; } void setAdjustedSortHint(HintAdjustedTimestampSort hint);
protected: protected:
//! Constructor //! Constructor