[boost][range] fusion::begin and boost::begin dont play nice

I am using g++ (GCC) 3.4.2 (mingw-special) and when I use the namespace
boost::fusion it causes boost range to break.
Consider the toy program 'main.cpp', which is attached and also listed
below:
-----------------------------------------------------------------------
#include <iostream>
using namespace std;
#include

John Femiani skrev:
I am using g++ (GCC) 3.4.2 (mingw-special) and when I use the namespace boost::fusion it causes boost range to break.
Consider the toy program 'main.cpp', which is attached and also listed below:
-----------------------------------------------------------------------
#include <iostream>
using namespace std;
#include
#include #include <list> int main() { using namespace boost::fusion; using namespace boost;
Please don't do this. If you really think it is too much to write boost::, use namespace b = boost; namespace bf = boost::fusion; -Thorsten

John Femiani skrev:
using namespace boost::fusion; using namespace boost;
Please don't do this. If you really think it is too much to write boost::, use
namespace b = boost; namespace bf = boost::fusion;
-Thorsten
Too much? I'm not lazy, just confused. I thought fusion would allow me to treat both types of container uniformly, and if I have to use different names that just isn't true. Perhaps I misunderstood Fusion. -- John

John Femiani skrev:
John Femiani skrev:
using namespace boost::fusion; using namespace boost;
Please don't do this. If you really think it is too much to write boost::, use
namespace b = boost; namespace bf = boost::fusion;
-Thorsten
Too much? I'm not lazy, just confused. I thought fusion would allow me to treat both types of container uniformly, and if I have to use different names that just isn't true. Perhaps I misunderstood Fusion.
This has, in general, nothing to do with Fusion or Range. The problem is, with your two statements,
using namespace boost::fusion; using namespace boost;
pulls in a potentially huge number of functions and classes. Many of these functions are unconstrained templates, eg. boost::begin() is. So which begin() function are you referring to? The correct way to use boost.range is to call boost::begin(). -Thorsten

This has, in general, nothing to do with Fusion or Range. The problem is, with your two statements,
using namespace boost::fusion; using namespace boost;
pulls in a potentially huge number of functions and classes. Many of these functions are unconstrained templates, eg. boost::begin() is. So which begin() function are you referring to? The correct way to use boost.range is to call boost::begin().
-Thorsten
I was following the examples in the boost range documentation fairly closely - they do not use boost::begin(). Anyhow I would have thought either one of those two should work in this case. Why doesn't boost::fusion::begin have a default implementation that calls boost::begin? I am really thinking that fusion might not be what I thought it was; I thought I would be able to take a function that used to work on a homogeneous container and then I could 'fusion'-ize it so that the same code would compile with any heterogeneous container or homogenous container. Apparently this is not the case; I think I need to use Fusion for heterogeneous and Range for homogenous, and have separate code to deal with each. -- John

John Femiani wrote:
Anyhow I would have thought either one of those two should work in this case. Why doesn't boost::fusion::begin have a default implementation that calls boost::begin?
I am really thinking that fusion might not be what I thought it was; I thought I would be able to take a function that used to work on a homogeneous container and then I could 'fusion'-ize it so that the same code would compile with any heterogeneous container or homogenous container. Apparently this is not the case; I think I need to use Fusion for heterogeneous and Range for homogenous, and have separate code to deal with each.
No, it can't do that. It has nothing to do with being homogeneous or heterogeneous. Fusion can only deal with data structures (homogeneous or heterogeneous) with a size that is known at compile time. Boost.Array is one such beast in the homogeneous world. Regards, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net
participants (3)
-
Joel de Guzman
-
John Femiani
-
Thorsten Ottosen