Skip to content

Commit

Permalink
Merge pull request #22 from chinnnathan/lib-cpp-new-agnostic-support
Browse files Browse the repository at this point in the history
Lib cpp new agnostic support
  • Loading branch information
danmcleran authored May 12, 2023
2 parents 0441af1 + 8632419 commit bee1372
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cpp/neuralnet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,10 @@ namespace tinymind {
this->mWeight = value;
}

void * operator new(size_t, void *p)
{
return p;
}
protected:
ValueType mWeight;
};
Expand Down Expand Up @@ -1323,6 +1327,11 @@ namespace tinymind {
this->mOutputValue = value;
}

void * operator new(size_t, void *p)
{
return p;
}

protected: // Don't instantiate class. Only for use by child classses
Neuron()
{
Expand Down Expand Up @@ -1960,6 +1969,11 @@ namespace tinymind {
NeuronType* pNeuron = reinterpret_cast<NeuronType*>(&this->mNeuronsBuffer[bufferIndex]);
pNeuron->setWeightForConnection(connection, weight);
}

void * operator new(size_t, void *p)
{
return p;
}
protected:
Layer()
{
Expand Down
5 changes: 5 additions & 0 deletions cpp/qformat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,11 @@ namespace tinymind {
return (mValue.getValue() != value);
}

void * operator new(size_t, void *p)
{
return p;
}

#if TINYMIND_ENABLE_OSTREAMS
friend std::ostream& operator<<(std::ostream& os, const QValue& value)
{
Expand Down

0 comments on commit bee1372

Please sign in to comment.