From 3f965312d61fac3970f1000ee6433cc154abcb6c Mon Sep 17 00:00:00 2001 From: ljfa Date: Tue, 22 Sep 2015 15:21:16 +0200 Subject: Explicitly instantiate and export templates in header and move defintions of tag_array::at to header --- include/tag_array.h | 10 +++++++--- include/tag_primitive.h | 8 ++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/tag_array.h b/include/tag_array.h index c59249b571..be9591c0f3 100644 --- a/include/tag_array.h +++ b/include/tag_array.h @@ -32,7 +32,7 @@ namespace detail { ///Meta-struct that holds the tag_type value for a specific array type template struct get_array_type - { static_assert(sizeof(T) != sizeof(T), "Invalid type paramter for tag_primitive, can only use byte or int"); }; + { static_assert(sizeof(T) != sizeof(T), "Invalid type paramter for tag_array, can only use byte or int"); }; template<> struct get_array_type : public std::integral_constant {}; template<> struct get_array_type : public std::integral_constant {}; @@ -73,8 +73,8 @@ public: * @brief Accesses a value by index with bounds checking * @throw std::out_of_range if the index is out of range */ - T& at(size_t i); - T at(size_t i) const; + T& at(size_t i) { return data.at(i); } + T at(size_t i) const { return data.at(i); } /** * @brief Accesses a value by index @@ -124,6 +124,10 @@ template bool operator!=(const tag_array& lhs, const tag_array& r typedef tag_array tag_byte_array; typedef tag_array tag_int_array; +//Explicit instantiations +template class NBT_EXPORT tag_array; +template class NBT_EXPORT tag_array; + } #endif // TAG_ARRAY_H_INCLUDED diff --git a/include/tag_primitive.h b/include/tag_primitive.h index 07ae985559..e3d5111e76 100644 --- a/include/tag_primitive.h +++ b/include/tag_primitive.h @@ -77,6 +77,14 @@ typedef tag_primitive tag_long; typedef tag_primitive tag_float; typedef tag_primitive tag_double; +//Explicit instantiations +template class NBT_EXPORT tag_primitive; +template class NBT_EXPORT tag_primitive; +template class NBT_EXPORT tag_primitive; +template class NBT_EXPORT tag_primitive; +template class NBT_EXPORT tag_primitive; +template class NBT_EXPORT tag_primitive; + template void tag_primitive::read_payload(io::stream_reader& reader) { -- cgit 0.0.5-2-1-g0f52