0

while finding the inverse of matrix using boost library, when I try to use this
using namespace boost::numeric::ublas;

then the compiler shows an error that

there is an ambiguity as there is a vector class also in boost library.

Any suggestions on how to overcome this.

Embedded C
  • 1,448
  • 3
  • 16
  • 29

1 Answers1

3

This is the kind of problem that you can expect from using directives. The best solution is to simply not use them. You can mitigate the scope for errors by using them in very limited scopes (e.g. inside function definitions). Alternatively, you can use namespace aliases to make your code more concise. For example,

namespace ublas = boost::numeric::ublas;
Community
  • 1
  • 1
juanchopanza
  • 223,364
  • 34
  • 402
  • 480
  • 1
    +1 for the namespace aliases as the cleanest solution to these problems. One of the most common aliases that I frequently see is `namespace bfs = boost::filesystem;`. An alternative would be to create aliases/typedefs for the most common types and `auto` to deduce as many types as possible. – anderas Mar 14 '16 at 07:55