[mpl::map & mpl::transform] Problems using mpl::map in mpl::for_each
Hello,
I have some slightly different code, which is presented in C++ Template Metaprogramming book to
use the mpl::for_each function:
mpl::for_each< mpl::transform
"Ovanes Markarian"
Hello,
I have some slightly different code, which is presented in C++ Template Metaprogramming book to use the mpl::for_each function:
mpl::for_each< mpl::transform
>::type >(dispatcher_type());
mpl::for_each
The deviation from the book is that my seq it not mpl::vector<...>, but mpl::map<...>
In the docs is written, that mpl::transform operates on Forward Sequence. In the doc of forward sequence is stated that mpl::map is a model of it.
The last release of mpl::map had some considerable bugs. Have you tried the latest version from the CVS HEAD (or RC_1_34_0)?
Unfortunately this code does not compile. I could transform the map to vector, but I would not like doing it, since that would cost compile time and slow down the compilation. Is it a known issue or should not I expect map to work with transform?
The code could "not compile" for many other reasons than that "map
doesn't work with transform." Have you tried to compile
typedef mpl::transform
I also tried using itertors on seq, but that did not help.
I think we'll need a lot more detail to be able to help you. -- Dave Abrahams Boost Consulting www.boost-consulting.com
Dave,
Here is a small example which produces errors:
#include <iostream>
#include <functional>
#include
::type>(bind<void>(*this, i, _1)); cout << "I did: " << i << " iterations\n"; }
template<class T>
void operator()(int& i, wrap<T>)const
{
cout <<"pos: " << i << ", type: " << typeid(T).name() <<
'\n';
++i;
}
};
#include <string>
int main(int argc, char* argv[])
{
dispatcher d;
d.dispatch
Hello,
I have some slightly different code, which is presented in C++ Template Metaprogramming book to use the mpl::for_each function:
mpl::for_each< mpl::transform
>::type (dispatcher_type());
mpl::for_each
The deviation from the book is that my seq it not mpl::vector<...>, but mpl::map<...>
In the docs is written, that mpl::transform operates on Forward Sequence. In the doc of forward sequence is stated that mpl::map is a model of it.
The last release of mpl::map had some considerable bugs. Have you tried the latest version from the CVS HEAD (or RC_1_34_0)?
Unfortunately this code does not compile. I could transform the map to vector, but I would not like doing it, since that would cost compile time and slow down the compilation. Is it a known issue or should not I expect map to work with transform?
The code could "not compile" for many other reasons than that "map doesn't
work with transform." Have you tried to compile
typedef mpl::transform
I also tried using itertors on seq, but that did not help.
I think we'll need a lot more detail to be able to help you. -- Dave Abrahams Boost Consulting www.boost-consulting.com _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Yes, this transoform which does not work. But this was also stated by the
compiler in the previous message ;) Just to ensure, that I have tried it :)
-----Original Message-----
From: Ovanes Markarian [mailto:om_boost@keywallet.com]
Sent: Thursday, November 02, 2006 11:02 PM
To: boost-users@lists.boost.org
Subject: Re: [Boost-users] [mpl::map & mpl::transform] Problemsusingmpl::map
in mpl::for_each
Dave,
Here is a small example which produces errors:
#include <iostream>
#include <functional>
#include
::type>(bind<void>(*this, i, _1)); cout << "I did: " << i << " iterations\n"; }
template<class T>
void operator()(int& i, wrap<T>)const
{
cout <<"pos: " << i << ", type: " << typeid(T).name() <<
'\n';
++i;
}
};
#include <string>
int main(int argc, char* argv[])
{
dispatcher d;
d.dispatch
Hello,
I have some slightly different code, which is presented in C++ Template Metaprogramming book to use the mpl::for_each function:
mpl::for_each< mpl::transform
>::type (dispatcher_type());
mpl::for_each
The deviation from the book is that my seq it not mpl::vector<...>, but mpl::map<...>
In the docs is written, that mpl::transform operates on Forward Sequence. In the doc of forward sequence is stated that mpl::map is a model of it.
The last release of mpl::map had some considerable bugs. Have you tried the latest version from the CVS HEAD (or RC_1_34_0)?
Unfortunately this code does not compile. I could transform the map to vector, but I would not like doing it, since that would cost compile time and slow down the compilation. Is it a known issue or should not I expect map to work with transform?
The code could "not compile" for many other reasons than that "map doesn't
work with transform." Have you tried to compile
typedef mpl::transform
I also tried using itertors on seq, but that did not help.
I think we'll need a lot more detail to be able to help you. -- Dave Abrahams Boost Consulting www.boost-consulting.com _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
"Ovanes Markarian"
Dave,
Here is a small example which produces errors:
#include <iostream> #include <functional> #include
#include #include #include #include #include #include #include #include #include
That's already not small. Please try answering all the questions in my email first. For example, The last release of mpl::map had some considerable bugs. Have you tried the latest version from the CVS HEAD (or RC_1_34_0)? -- Dave Abrahams Boost Consulting www.boost-consulting.com
Thanks I will do it. Should I only replace mpl/map.hpp or the entire mpl lib? In my previous mail I also asked about a map containing 150 pair elements. Could you maybe take a look at it... I simply can not force preprocessor generate that kind of data structure for me. Unfortunately, this is essential for me to have such a big map, since it represents some communication protocol with possible message types. With Kind Regards, Ovanes Markarian On Fri, November 3, 2006 15:56, David Abrahams wrote:
"Ovanes Markarian"
writes: Dave,
Here is a small example which produces errors:
#include <iostream> #include <functional> #include
#include #include #include #include #include #include #include #include #include That's already not small.
Please try answering all the questions in my email first. For example,
The last release of mpl::map had some considerable bugs. Have you tried the latest version from the CVS HEAD (or RC_1_34_0)?
-- Dave Abrahams Boost Consulting www.boost-consulting.com
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
"Ovanes Markarian"
Thanks I will do it. Should I only replace mpl/map.hpp or the entire mpl lib?
You need to replace all of Boost.
In my previous mail I also asked about a map containing 150 pair elements. Could you maybe take a look at it...
That's Aleksey's territory; I've asked him to look. -- Dave Abrahams Boost Consulting www.boost-consulting.com
participants (2)
-
David Abrahams
-
Ovanes Markarian