Re: returning a ublas matrix from a function

PB <[email protected]>
Newsgroups gmane.comp.lib.boost.ublas
Message-ID <CACA1MsTiTbutcbYjuQKK20eEs6SHTx6CfCo15uvyPNTnzib+Rg@mail.gmail.com>
You've declared main() as returning int but you're trying to return a type
that isn't an int. What do you expect to happen? The compiler error is
pretty clear here IMO.


On Tue, Aug 5, 2014 at 9:27 AM, sanann <[email protected]> wrote:

> Thank you very much for that.
>
> but on the other hand i tried the same with another part of my code but i
> still get the same error. could you kindly help me through this too.
>
> int main(int argc, char *argv[])
> {
>     QApplication a(argc, argv);
>     const size_t arraySize = 3;
>     boost::numeric::ublas::matrix<double> M[arraySize] =
>     {
>         boost::numeric::ublas::scalar_matrix<double>(2, 2),
>         boost::numeric::ublas::scalar_matrix<double>(3, 3),
>         boost::numeric::ublas::scalar_matrix<double>(4, 4)
>     };
>
>
>      for (int i=0;i<4;i++)
>      {
>          std::cout << M[i]<< std::endl;
>      }
>      return M;
> }
>
> I end up with the same error.
> error: invalid conversion from 'boost::numeric::ublas::matrix<double>*' to
> 'int' [-fpermissive]
>       return M;
>              ^
>
>
>
> --
> View this message in context:
> http://boost.2283326.n4.nabble.com/returning-a-ublas-matrix-from-a-function-tp4666050p4666054.html
> Sent from the Boost - uBLAS mailing list archive at Nabble.com.
> _______________________________________________
> ublas mailing list
> [email protected]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: [email protected]
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.