diff --git a/code/cpp/samples/yggdrasil_dimensionArray.hpp b/code/cpp/samples/yggdrasil_dimensionArray.hpp index 2dab4fcd1f83a9822b00c79c6fbc0bf23477fea0..53e372c98da3eed9baf1b3c89283460c19f2b75f 100644 --- a/code/cpp/samples/yggdrasil_dimensionArray.hpp +++ b/code/cpp/samples/yggdrasil_dimensionArray.hpp @@ -407,6 +407,32 @@ public: }; //End: operator[] (const) + /** + * \brief This function sets all values of *this to v. + * + * This function bypasses v to the assign function of the underlying container. + * There is no check performed on v. + * The only requirement is that *this is valid. + * All components of *this will afterwards be equal v. + * + * \param v The value we use for assigning. + */ + void + assign( + const Numeric_t v) + { + if(this->hasValidDimensions() == false) + { + throw YGGDRASIL_EXCEPT_RUNTIME("Tried to use an invalid dimension array for assigning."); + }; + + //Call the internal function for teh assigning + this->m_data.assign(this->m_data.size(), v); //Assign needs the size + + return; + }; //End assign + + /* * ================================== * Iterator access function