
AMDG Joel FALCOU wrote:
Hi dear members,
I'm currently working on some template based DSL using MPL and proto and i came across some really strange problem.I'll try to give as much details as possible, but I mus confess I'm really los so some important things may have slipped.
So, i have a class called matrix which is a simple end-user class for handling multidimensionnal array of data. It's declared as follow :
template
> class matrix : public process_settings ::type; <snip>
Now, this shape class is overloaded for each shape type by using tempalte argument. For ex., the dense shape overload is given by shape
, where T is the element of the matrix and options the processed map of options. This class does all the grutn work of allocating, freeing and accessing elements. I also have a method called size() that returns the size of the shape in nbr of elment. matrix::size then just call back this size() method. Now I had the need to have a free function called size that take a matrix and call .size() on it. Alas, the compiler don't let me do it right :/ Using gcc 4.1 (on linux or using mingw) i got the following error :
<snip>
Basically, instead of using my size() function, the compiler fetches boost::mpl::size ... I checked and triple checked that i have NO using namespace boost anywhere and that, if I rename size into let's say gimme_size, it works. It just fail at finding size cause he find the mpl structure instead. Same for any function name like at or stuff like this (ie names that are also a mpl class name). Now, if matrix ends up with only ONE tempalte arguments (ie T), it works fine ...
I'm completely lost. Even if i know that i can just rename this, i don't want to just let it go. Either I did something stupid, either there is some bug (I think the former alas) and i don't want such errors resufraces later in some unrelated code. If details on the class actual definition is needed, I'll post them.
I would be helpful to see the definition of settings<>. Are any of it's template parameters or base classes in namespace mpl? Ok, yes. I suspect that the compiler is finding mpl::size by ADL. I don't think it ought to, but I'll look it up. I'd also like to know what happens with another compiler. In Christ, Steven Watanabe