Skip to content

Commit

Permalink
Explicitly instantiate the metadata vectors to avoid linker issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Auburn committed May 9, 2024
1 parent 000bffa commit 53cfcd7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 5 additions & 5 deletions include/FastNoise/Metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ namespace FastNoise
{
public:
using const_iterator = const T*;
// template solves dll linking when not inlining
template<typename = T> const_iterator begin() const { return data() + mStart; }
template<typename = T> const_iterator end() const { return data() + mEnd; }
template<typename = T> size_t size() const { return mEnd - mStart; }
template<typename = T> const T& operator []( size_t i ) const { return begin()[i]; }

const_iterator begin() const { return data() + mStart; }
const_iterator end() const { return data() + mEnd; }
size_t size() const { return mEnd - mStart; }
const T& operator []( size_t i ) const { return begin()[i]; }

private:
template<typename>
Expand Down
6 changes: 6 additions & 0 deletions src/FastNoise/Metadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ void Metadata::Vector<T>::push_back( const T& value )
mStart = std::min( mStart, mEnd++ );
}

template class Metadata::Vector<const Metadata*>;
template class Metadata::Vector<const char*>;
template class Metadata::Vector<Metadata::MemberVariable>;
template class Metadata::Vector<Metadata::MemberNodeLookup>;
template class Metadata::Vector<Metadata::MemberHybrid>;

template<typename T>
void AddToDataStream( std::vector<uint8_t>& dataStream, T value )
{
Expand Down

0 comments on commit 53cfcd7

Please sign in to comment.