[graph] ranges used by boost.graph not compatible with c++11 range-based-for
Sadly, I don't think there s a way of turn an std::pair of iterators into a range-based-for-compliant range (see [1]).
correct me if I'm missing something, but when performing ADL the namespaces of the template parameters are in the set of associated namespaces. So, one could simply overload begin/end in the namespace where the iterator types are defined ...
You're right, a per-namespace solution is possible. I don't think it can be done in general, though (i.e. for all std::pairs of iterators in one stroke). I'm not familiar with BGL - are the iterator types in question defined in a namespace under the library's control, or could they be user-provided types (in which the case the user would have to put the begin()/end() in their own namespace)? Regards, Nate
On Thu, 3 Oct 2013, Nathan Ridge wrote:
Sadly, I don't think there s a way of turn an std::pair of iterators into a range-based-for-compliant range (see [1]).
correct me if I'm missing something, but when performing ADL the namespaces of the template parameters are in the set of associated namespaces. So, one could simply overload begin/end in the namespace where the iterator types are defined ...
You're right, a per-namespace solution is possible. I don't think it can be done in general, though (i.e. for all std::pairs of iterators in one stroke).
I'm not familiar with BGL - are the iterator types in question defined in a namespace under the library's control, or could they be user-provided types (in which the case the user would have to put the begin()/end() in their own namespace)?
For BGL-provided graph types, they are usually in a namespace under the library's control (I believe some are just std::vector<...>::iterator and similar, though). For user-defined graph types, they can be from anywhere, and requiring begin and end would break backward compatibility. -- Jeremiah Willcock
participants (2)
-
Jeremiah Willcock
-
Nathan Ridge