Hi mlpack community!
I’m not sure it is a right place to ask a question that I want to ask, but,
anyway, maybe somebody will be eager to answer. Otherwise, just ignore this
message.
I have encountered some unexpected behaviour with the Armadillo library. The
following code snippet works as expected:
template<typename T>
void f(const T& arg)
{
arma::mat m = arg;
}
BOOST_AUTO_TEST_CASE(RefTest)
{
f(arma::join_rows(arma::zeros(2).t(), arma::zeros(2).t()));
}
But if I run the following
BOOST_AUTO_TEST_CASE(RefTest2)
{
const auto& ref = arma::join_rows(arma::zeros(2).t(), arma::zeros(2).t());
arma::mat m = ref;
}
I get this error:
unknown location:0: fatal error: in "ArmaExtendTest/RefTest2": memory access
violation at address: 0x00000000: no mapping at fault address
Surprisingly, if run the following code snippet
BOOST_AUTO_TEST_CASE(RefTest3)
{
const auto& ref = arma::join_rows(arma::zeros(2), arma::zeros(2));
arma::mat m = ref;
}
everything is ok again.
Are there any thoughts why I observe such behaviour?
Best regards,
Kirill Mishchenko
_______________________________________________
mlpack mailing list
[email protected]
http://knife.lugatgt.org/cgi-bin/mailman/listinfo/mlpack