[iterator] Using zip_iterator with std::pair

Hi! I would like to use the boost::zip_iterator with std::pair. Unfortunately this does not work out of the box, but there exists a namespace boost::detail::tuple_impl_specific, which apparently needs to be specialised for each tuple type. I managed to re-implement tuple_meta_transform and tuple_meta_accumulate for std::tuple, which seems to be straightforward. However, there are functions of the form template<typename Tuple, typename Fun> complex_result_type tuple_transform(const Tuple&, Fun) which have to be overloaded as well, if I am not mistaken. However, overloading this with something like template<typename... Args, typename Fun> complex_result_type tuple_transform(const std::tuple<Args...>&, Fun) is probably not going to work, since this would be a partial template specialisation of a function. What is the recommended way of proceeding here? Or am I making things to complicated and there exists a simpler solution to using the zip iterator with std::pair / std::tuple. Any support would be appreciated. Regards Claas P.S: I am using boost 1.50 with gcc-4.6 and the C++11 standard.

On Tue, Oct 16, 2012 at 9:06 AM, "Claas H. Köhler" <claas.koehler@dlr.de> wrote:
Hi!
I would like to use the boost::zip_iterator with std::pair. Unfortunately this does not work out of the box, but there exists a namespace boost::detail::tuple_impl_specific, which apparently needs to be specialised for each tuple type.
I managed to re-implement tuple_meta_transform and tuple_meta_accumulate for std::tuple, which seems to be straightforward. However, there are functions of the form
template<typename Tuple, typename Fun> complex_result_type tuple_transform(const Tuple&, Fun)
which have to be overloaded as well, if I am not mistaken. However, overloading this with something like template<typename... Args, typename Fun> complex_result_type tuple_transform(const std::tuple<Args...>&, Fun)
is probably not going to work, since this would be a partial template specialisation of a function.
That's an overload actually and should work fine. Did you try it? HTH, -- gpd

On 16/10/12 12:01, Giovanni Piero Deretta wrote:
On Tue, Oct 16, 2012 at 9:06 AM, "Claas H. Köhler" <claas.koehler@dlr.de> wrote:
Hi!
I would like to use the boost::zip_iterator with std::pair. Unfortunately this does not work out of the box, but there exists a namespace boost::detail::tuple_impl_specific, which apparently needs to be specialised for each tuple type.
I managed to re-implement tuple_meta_transform and tuple_meta_accumulate for std::tuple, which seems to be straightforward. However, there are functions of the form
template<typename Tuple, typename Fun> complex_result_type tuple_transform(const Tuple&, Fun)
which have to be overloaded as well, if I am not mistaken. However, overloading this with something like template<typename... Args, typename Fun> complex_result_type tuple_transform(const std::tuple<Args...>&, Fun)
is probably not going to work, since this would be a partial template specialisation of a function.
That's an overload actually and should work fine. Did you try it?
HTH,
Thanks for the hint. I have to admit I did not try it yet. I have just created a similar simple test case, which indeed compiles/works fine. Shame on me for not trying it out. For me this was always a classical example of template function specialisation. I guess I should take a look at template basics again :-) Sorry for that and thanks for the quick response. Regards Claas

On Tue, Oct 16, 2012 at 4:21 AM, "Claas H. Köhler" <claas.koehler@dlr.de>wrote:
On 16/10/12 12:01, Giovanni Piero Deretta wrote:
On Tue, Oct 16, 2012 at 9:06 AM, "Claas H. Köhler" <claas.koehler@dlr.de> wrote:
Hi!
I would like to use the boost::zip_iterator with std::pair. Unfortunately this does not work out of the box, but there exists a namespace boost::detail::tuple_impl_specific, which apparently needs to be specialised for each tuple type.
Hmmm...I guess it makes sense you might have to specialize something if zip_iterator doesn't specifically know about your desired tuple type.
I managed to re-implement tuple_meta_transform and tuple_meta_accumulate for std::tuple, which seems to be straightforward. However, there are functions of the form
template<typename Tuple, typename Fun> complex_result_type tuple_transform(const Tuple&, Fun)
which have to be overloaded as well, if I am not mistaken. However, overloading this with something like template<typename... Args, typename Fun> complex_result_type tuple_transform(const std::tuple<Args...>&, Fun)
is probably not going to work, since this would be a partial template specialisation of a function.
That's an overload actually and should work fine. Did you try it?
HTH,
Thanks for the hint. I have to admit I did not try it yet. I have just created a similar simple test case, which indeed compiles/works fine. Shame on me for not trying it out. For me this was always a classical example of template function specialisation. I guess I should take a look at template basics again :-)
Sorry for that and thanks for the quick response.
I'm glad you got it working, but ideally, I think, zip_iterator should work out of the box for std::pair and std::tuple. Could I trouble you to provide patches based on what you needed to get this to work? - Jeff

On 16/10/12 14:27, Jeffrey Lee Hellrung, Jr. wrote:
On Tue, Oct 16, 2012 at 4:21 AM, "Claas H. Köhler" <claas.koehler@dlr.de>wrote:
On 16/10/12 12:01, Giovanni Piero Deretta wrote:
On Tue, Oct 16, 2012 at 9:06 AM, "Claas H. Köhler" <claas.koehler@dlr.de> wrote:
Hi!
I would like to use the boost::zip_iterator with std::pair. Unfortunately this does not work out of the box, but there exists a namespace boost::detail::tuple_impl_specific, which apparently needs to be specialised for each tuple type.
Hmmm...I guess it makes sense you might have to specialize something if zip_iterator doesn't specifically know about your desired tuple type.
I managed to re-implement tuple_meta_transform and tuple_meta_accumulate for std::tuple, which seems to be straightforward. However, there are functions of the form
template<typename Tuple, typename Fun> complex_result_type tuple_transform(const Tuple&, Fun)
which have to be overloaded as well, if I am not mistaken. However, overloading this with something like template<typename... Args, typename Fun> complex_result_type tuple_transform(const std::tuple<Args...>&, Fun)
is probably not going to work, since this would be a partial template specialisation of a function.
That's an overload actually and should work fine. Did you try it?
HTH,
Thanks for the hint. I have to admit I did not try it yet. I have just created a similar simple test case, which indeed compiles/works fine. Shame on me for not trying it out. For me this was always a classical example of template function specialisation. I guess I should take a look at template basics again :-)
Sorry for that and thanks for the quick response.
I'm glad you got it working, but ideally, I think, zip_iterator should work out of the box for std::pair and std::tuple. Could I trouble you to provide patches based on what you needed to get this to work?
- Jeff
Unfortunately things are not working yet. As far as I can judge, the problem is that some of the functions are called from within the zip_iterator.hpp header file, which is before I can actually define the overloaded functions. As a result the overloaded functions are not called. Should I get this working, however, I am glad to share the wisdom. Regards Claas

On Tue, Oct 16, 2012 at 10:06 AM, "Claas H. Köhler" <claas.koehler@dlr.de>wrote:
On Tue, Oct 16, 2012 at 4:21 AM, "Claas H. Köhler" <claas.koehler@dlr.de wrote:
On 16/10/12 12:01, Giovanni Piero Deretta wrote:
On Tue, Oct 16, 2012 at 9:06 AM, "Claas H. Köhler" <
claas.koehler@dlr.de>
wrote:
Hi!
I would like to use the boost::zip_iterator with std::pair. Unfortunately this does not work out of the box, but there exists a namespace boost::detail::tuple_impl_specific, which apparently needs to be specialised for each tuple type.
Hmmm...I guess it makes sense you might have to specialize something if zip_iterator doesn't specifically know about your desired tuple type.
I managed to re-implement tuple_meta_transform and tuple_meta_accumulate for std::tuple, which seems to be straightforward. However, there are functions of the form
template<typename Tuple, typename Fun> complex_result_type tuple_transform(const Tuple&, Fun)
which have to be overloaded as well, if I am not mistaken. However, overloading this with something like template<typename... Args, typename Fun> complex_result_type tuple_transform(const std::tuple<Args...>&, Fun)
is probably not going to work, since this would be a partial template specialisation of a function.
That's an overload actually and should work fine. Did you try it?
HTH,
Thanks for the hint. I have to admit I did not try it yet. I have just created a similar simple test case, which indeed compiles/works fine. Shame on me for not trying it out. For me this was always a classical example of template function specialisation. I guess I should take a look at template basics again :-)
Sorry for that and thanks for the quick response.
I'm glad you got it working, but ideally, I think, zip_iterator should work out of the box for std::pair and std::tuple. Could I trouble you to
On 16/10/12 14:27, Jeffrey Lee Hellrung, Jr. wrote: provide
patches based on what you needed to get this to work?
- Jeff
Unfortunately things are not working yet. As far as I can judge, the problem is that some of the functions are called from within the zip_iterator.hpp header file, which is before I can actually define the overloaded functions. As a result the overloaded functions are not called.
Should I get this working, however, I am glad to share the wisdom.
Well, I'd consider it fair game to edit the zip_iterator.hpp header file directly :) - Jeff

On 17/10/12 04:28, Jeffrey Lee Hellrung, Jr. wrote:
On Tue, Oct 16, 2012 at 10:06 AM, "Claas H. Köhler" <claas.koehler@dlr.de>wrote:
On Tue, Oct 16, 2012 at 4:21 AM, "Claas H. Köhler" <claas.koehler@dlr.de wrote:
On 16/10/12 12:01, Giovanni Piero Deretta wrote:
On Tue, Oct 16, 2012 at 9:06 AM, "Claas H. Köhler" <
claas.koehler@dlr.de>
wrote:
Hi!
I would like to use the boost::zip_iterator with std::pair. Unfortunately this does not work out of the box, but there exists a namespace boost::detail::tuple_impl_specific, which apparently needs to be specialised for each tuple type.
Hmmm...I guess it makes sense you might have to specialize something if zip_iterator doesn't specifically know about your desired tuple type.
I managed to re-implement tuple_meta_transform and tuple_meta_accumulate for std::tuple, which seems to be straightforward. However, there are functions of the form
template<typename Tuple, typename Fun> complex_result_type tuple_transform(const Tuple&, Fun)
which have to be overloaded as well, if I am not mistaken. However, overloading this with something like template<typename... Args, typename Fun> complex_result_type tuple_transform(const std::tuple<Args...>&, Fun)
is probably not going to work, since this would be a partial template specialisation of a function.
That's an overload actually and should work fine. Did you try it?
HTH,
Thanks for the hint. I have to admit I did not try it yet. I have just created a similar simple test case, which indeed compiles/works fine. Shame on me for not trying it out. For me this was always a classical example of template function specialisation. I guess I should take a look at template basics again :-)
Sorry for that and thanks for the quick response.
I'm glad you got it working, but ideally, I think, zip_iterator should work out of the box for std::pair and std::tuple. Could I trouble you to
On 16/10/12 14:27, Jeffrey Lee Hellrung, Jr. wrote: provide
patches based on what you needed to get this to work?
- Jeff
Unfortunately things are not working yet. As far as I can judge, the problem is that some of the functions are called from within the zip_iterator.hpp header file, which is before I can actually define the overloaded functions. As a result the overloaded functions are not called.
Should I get this working, however, I am glad to share the wisdom.
Well, I'd consider it fair game to edit the zip_iterator.hpp header file directly :)
- Jeff
Looks like I found a working solution. I transformed the tuple_xxx template functions into template structs, for which overloading seemingly works fine. Since I am not familiar with boost::mpl I used my own versions of the meta transformations based on C++11. For tuple this may not be an issue, since its a C++11 feature, but for std::pair it could be. Furthermore I would suggest to implement these functions exclusively for boost::tuple and leave the general template unimplemented. This may ease specialisations of other classes. Using C++11 for example the specialisations for std::pair and std::tuple are almost identical, but have to be specialised individually. Just my 0.02$ . Shall I post the modified code directly to the mailing list or somewhere else? Regards Claas

On Wed, Oct 17, 2012 at 12:08 AM, "Claas H. Köhler" <claas.koehler@dlr.de>wrote:
On 17/10/12 04:28, Jeffrey Lee Hellrung, Jr. wrote:
On Tue, Oct 16, 2012 at 10:06 AM, "Claas H. Köhler" < claas.koehler@dlr.de>wrote:
On 16/10/12 14:27, Jeffrey Lee Hellrung, Jr. wrote:
On Tue, Oct 16, 2012 at 4:21 AM, "Claas H. Köhler" <
claas.koehler@dlr.de
wrote:
On 16/10/12 12:01, Giovanni Piero Deretta wrote:
On Tue, Oct 16, 2012 at 9:06 AM, "Claas H. Köhler" <
claas.koehler@dlr.de>
wrote:
> Hi! > > I would like to use the boost::zip_iterator with std::pair. Unfortunately this does not work out of > the box, but there exists a namespace boost::detail::tuple_impl_specific, which apparently needs to > be specialised for each tuple type.
Hmmm...I guess it makes sense you might have to specialize something if zip_iterator doesn't specifically know about your desired tuple type.
> I managed to re-implement tuple_meta_transform and tuple_meta_accumulate for std::tuple, which seems > to be straightforward. However, there are functions of the form > > template<typename Tuple, typename Fun> > complex_result_type tuple_transform(const Tuple&, Fun) > > which have to be overloaded as well, if I am not mistaken. However, overloading this with something like > template<typename... Args, typename Fun> > complex_result_type tuple_transform(const std::tuple<Args...>&, Fun) > > is probably not going to work, since this would be a partial template specialisation of a function.
That's an overload actually and should work fine. Did you try it?
HTH,
Thanks for the hint. I have to admit I did not try it yet. I have just created a similar simple test case, which indeed compiles/works fine. Shame on me for not trying it out. For me this was always a classical example of template function specialisation. I guess I should take a look at template basics again :-)
Sorry for that and thanks for the quick response.
I'm glad you got it working, but ideally, I think, zip_iterator should work out of the box for std::pair and std::tuple. Could I trouble you to provide patches based on what you needed to get this to work?
- Jeff
Unfortunately things are not working yet. As far as I can judge, the problem is that some of the functions are called from within the zip_iterator.hpp header file, which is before I can actually define the overloaded functions. As a result the overloaded functions are not called.
Should I get this working, however, I am glad to share the wisdom.
Well, I'd consider it fair game to edit the zip_iterator.hpp header file directly :)
- Jeff
Looks like I found a working solution. I transformed the tuple_xxx template functions into template structs, for which overloading seemingly works fine. Since I am not familiar with boost::mpl I used my own versions of the meta transformations based on C++11. For tuple this may not be an issue, since its a C++11 feature, but for std::pair it could be.
Furthermore I would suggest to implement these functions exclusively for boost::tuple and leave the general template unimplemented. This may ease specialisations of other classes. Using C++11 for example the specialisations for std::pair and std::tuple are almost identical, but have to be specialised individually. Just my 0.02$ .
Shall I post the modified code directly to the mailing list or somewhere else?
Create a trac ticket, attach any patches, and I'll take a look at it when I get a chance. - Jeff

On 17/10/12 13:21, Jeffrey Lee Hellrung, Jr. wrote:
On Wed, Oct 17, 2012 at 12:08 AM, "Claas H. Köhler" <claas.koehler@dlr.de>wrote:
On 17/10/12 04:28, Jeffrey Lee Hellrung, Jr. wrote:
On Tue, Oct 16, 2012 at 10:06 AM, "Claas H. Köhler" < claas.koehler@dlr.de>wrote:
On 16/10/12 14:27, Jeffrey Lee Hellrung, Jr. wrote:
On Tue, Oct 16, 2012 at 4:21 AM, "Claas H. Köhler" <
claas.koehler@dlr.de
wrote:
On 16/10/12 12:01, Giovanni Piero Deretta wrote: > On Tue, Oct 16, 2012 at 9:06 AM, "Claas H. Köhler" <
claas.koehler@dlr.de>
wrote: >> Hi! >> >> I would like to use the boost::zip_iterator with std::pair. Unfortunately this does not work out of >> the box, but there exists a namespace boost::detail::tuple_impl_specific, which apparently needs to >> be specialised for each tuple type.
Hmmm...I guess it makes sense you might have to specialize something if zip_iterator doesn't specifically know about your desired tuple type.
>> I managed to re-implement tuple_meta_transform and tuple_meta_accumulate for std::tuple, which seems >> to be straightforward. However, there are functions of the form >> >> template<typename Tuple, typename Fun> >> complex_result_type tuple_transform(const Tuple&, Fun) >> >> which have to be overloaded as well, if I am not mistaken. However, overloading this with something like >> template<typename... Args, typename Fun> >> complex_result_type tuple_transform(const std::tuple<Args...>&, Fun) >> >> is probably not going to work, since this would be a partial template specialisation of a function. > > That's an overload actually and should work fine. Did you try it? > > HTH,
Thanks for the hint. I have to admit I did not try it yet. I have just created a similar simple test case, which indeed compiles/works fine. Shame on me for not trying it out. For me this was always a classical example of template function specialisation. I guess I should take a look at template basics again :-)
Sorry for that and thanks for the quick response.
I'm glad you got it working, but ideally, I think, zip_iterator should work out of the box for std::pair and std::tuple. Could I trouble you to provide patches based on what you needed to get this to work?
- Jeff
Unfortunately things are not working yet. As far as I can judge, the problem is that some of the functions are called from within the zip_iterator.hpp header file, which is before I can actually define the overloaded functions. As a result the overloaded functions are not called.
Should I get this working, however, I am glad to share the wisdom.
Well, I'd consider it fair game to edit the zip_iterator.hpp header file directly :)
- Jeff
Looks like I found a working solution. I transformed the tuple_xxx template functions into template structs, for which overloading seemingly works fine. Since I am not familiar with boost::mpl I used my own versions of the meta transformations based on C++11. For tuple this may not be an issue, since its a C++11 feature, but for std::pair it could be.
Furthermore I would suggest to implement these functions exclusively for boost::tuple and leave the general template unimplemented. This may ease specialisations of other classes. Using C++11 for example the specialisations for std::pair and std::tuple are almost identical, but have to be specialised individually. Just my 0.02$ .
Shall I post the modified code directly to the mailing list or somewhere else?
Create a trac ticket, attach any patches, and I'll take a look at it when I get a chance.
- Jeff
I just created ticket #7526 with a proposed patch. I am not sure, whether I got the different compiler macros right, though, since I do not have access to the compilers they are intented for. Furthermore you may want to enclose the std::tuple stuff (including namespace helper) into a macro, which enables it if C++11 is used (I presume such a macro does already exist, but I did not know its exact syntax). Hope that helps. Regards Claas

On Thu, Oct 18, 2012 at 3:11 AM, "Claas H. Köhler" <claas.koehler@dlr.de>wrote:
On Wed, Oct 17, 2012 at 12:08 AM, "Claas H. Köhler" < claas.koehler@dlr.de>wrote:
On 17/10/12 04:28, Jeffrey Lee Hellrung, Jr. wrote:
On Tue, Oct 16, 2012 at 10:06 AM, "Claas H. Köhler" < claas.koehler@dlr.de>wrote:
On 16/10/12 14:27, Jeffrey Lee Hellrung, Jr. wrote:
On Tue, Oct 16, 2012 at 4:21 AM, "Claas H. Köhler" <
claas.koehler@dlr.de
wrote:
> > > On 16/10/12 12:01, Giovanni Piero Deretta wrote: >> On Tue, Oct 16, 2012 at 9:06 AM, "Claas H. Köhler" < claas.koehler@dlr.de> > wrote: >>> Hi! >>> >>> I would like to use the boost::zip_iterator with std::pair. > Unfortunately this does not work out of >>> the box, but there exists a namespace > boost::detail::tuple_impl_specific, which apparently needs to >>> be specialised for each tuple type. >
Hmmm...I guess it makes sense you might have to specialize something
if
zip_iterator doesn't specifically know about your desired tuple type.
>>> I managed to re-implement tuple_meta_transform and > tuple_meta_accumulate for std::tuple, which seems >>> to be straightforward. However, there are functions of the form >>> >>> template<typename Tuple, typename Fun> >>> complex_result_type tuple_transform(const Tuple&, Fun) >>> >>> which have to be overloaded as well, if I am not mistaken. However, > overloading this with something like >>> template<typename... Args, typename Fun> >>> complex_result_type tuple_transform(const std::tuple<Args...>&, Fun) >>> >>> is probably not going to work, since this would be a partial template > specialisation of a function. >> >> That's an overload actually and should work fine. Did you try it? >> >> HTH, > > Thanks for the hint. I have to admit I did not try it yet. I have just > created a similar simple test > case, which indeed compiles/works fine. Shame on me for not trying it out. > For me this was always a > classical example of template function specialisation. I guess I should > take a look at template > basics again :-) > > Sorry for that and thanks for the quick response. >
I'm glad you got it working, but ideally, I think, zip_iterator should work out of the box for std::pair and std::tuple. Could I trouble you to provide patches based on what you needed to get this to work?
- Jeff
Unfortunately things are not working yet. As far as I can judge, the problem is that some of the functions are called from within the zip_iterator.hpp header file, which is before I can actually define the overloaded functions. As a result the overloaded functions are not called.
Should I get this working, however, I am glad to share the wisdom.
Well, I'd consider it fair game to edit the zip_iterator.hpp header file directly :)
- Jeff
Looks like I found a working solution. I transformed the tuple_xxx template functions into template structs, for which overloading seemingly works fine. Since I am not familiar with boost::mpl I used my own versions of the meta transformations based on C++11. For tuple
On 17/10/12 13:21, Jeffrey Lee Hellrung, Jr. wrote: this
may not be an issue, since its a C++11 feature, but for std::pair it could be.
Furthermore I would suggest to implement these functions exclusively for boost::tuple and leave the general template unimplemented. This may ease specialisations of other classes. Using C++11 for example the specialisations for std::pair and std::tuple are almost identical, but have to be specialised individually. Just my 0.02$ .
Shall I post the modified code directly to the mailing list or somewhere else?
Create a trac ticket, attach any patches, and I'll take a look at it when I get a chance.
- Jeff
I just created ticket #7526 with a proposed patch. I am not sure, whether I got the different compiler macros right, though, since I do not have access to the compilers they are intented for. Furthermore you may want to enclose the std::tuple stuff (including namespace helper) into a macro, which enables it if C++11 is used (I presume such a macro does already exist, but I did not know its exact syntax).
Great, thanks! I'll try to get to this before 1.53.0 is released. Did you add a unit test by chance? As for conditioning on the existence of std::tuple, looks like BOOST_NO_CXX11_HDR_TUPLE and BOOST_HAS_TR1_TUPLE would be macros to use. - Jeff

On 18/10/12 15:00, Jeffrey Lee Hellrung, Jr. wrote:
On Thu, Oct 18, 2012 at 3:11 AM, "Claas H. Köhler" <claas.koehler@dlr.de>wrote:
On Wed, Oct 17, 2012 at 12:08 AM, "Claas H. Köhler" < claas.koehler@dlr.de>wrote:
On 17/10/12 04:28, Jeffrey Lee Hellrung, Jr. wrote:
On Tue, Oct 16, 2012 at 10:06 AM, "Claas H. Köhler" < claas.koehler@dlr.de>wrote:
On 16/10/12 14:27, Jeffrey Lee Hellrung, Jr. wrote: > On Tue, Oct 16, 2012 at 4:21 AM, "Claas H. Köhler" <
claas.koehler@dlr.de
> wrote: > >> >> >> On 16/10/12 12:01, Giovanni Piero Deretta wrote: >>> On Tue, Oct 16, 2012 at 9:06 AM, "Claas H. Köhler" < claas.koehler@dlr.de> >> wrote: >>>> Hi! >>>> >>>> I would like to use the boost::zip_iterator with std::pair. >> Unfortunately this does not work out of >>>> the box, but there exists a namespace >> boost::detail::tuple_impl_specific, which apparently needs to >>>> be specialised for each tuple type. >> > > Hmmm...I guess it makes sense you might have to specialize something
if
> zip_iterator doesn't specifically know about your desired tuple type. > > >>>> I managed to re-implement tuple_meta_transform and >> tuple_meta_accumulate for std::tuple, which seems >>>> to be straightforward. However, there are functions of the form >>>> >>>> template<typename Tuple, typename Fun> >>>> complex_result_type tuple_transform(const Tuple&, Fun) >>>> >>>> which have to be overloaded as well, if I am not mistaken. However, >> overloading this with something like >>>> template<typename... Args, typename Fun> >>>> complex_result_type tuple_transform(const std::tuple<Args...>&, Fun) >>>> >>>> is probably not going to work, since this would be a partial template >> specialisation of a function. >>> >>> That's an overload actually and should work fine. Did you try it? >>> >>> HTH, >> >> Thanks for the hint. I have to admit I did not try it yet. I have just >> created a similar simple test >> case, which indeed compiles/works fine. Shame on me for not trying it out. >> For me this was always a >> classical example of template function specialisation. I guess I should >> take a look at template >> basics again :-) >> >> Sorry for that and thanks for the quick response. >> > > I'm glad you got it working, but ideally, I think, zip_iterator should work > out of the box for std::pair and std::tuple. Could I trouble you to provide > patches based on what you needed to get this to work? > > - Jeff
Unfortunately things are not working yet. As far as I can judge, the problem is that some of the functions are called from within the zip_iterator.hpp header file, which is before I can actually define the overloaded functions. As a result the overloaded functions are not called.
Should I get this working, however, I am glad to share the wisdom.
Well, I'd consider it fair game to edit the zip_iterator.hpp header file directly :)
- Jeff
Looks like I found a working solution. I transformed the tuple_xxx template functions into template structs, for which overloading seemingly works fine. Since I am not familiar with boost::mpl I used my own versions of the meta transformations based on C++11. For tuple
On 17/10/12 13:21, Jeffrey Lee Hellrung, Jr. wrote: this
may not be an issue, since its a C++11 feature, but for std::pair it could be.
Furthermore I would suggest to implement these functions exclusively for boost::tuple and leave the general template unimplemented. This may ease specialisations of other classes. Using C++11 for example the specialisations for std::pair and std::tuple are almost identical, but have to be specialised individually. Just my 0.02$ .
Shall I post the modified code directly to the mailing list or somewhere else?
Create a trac ticket, attach any patches, and I'll take a look at it when I get a chance.
- Jeff
I just created ticket #7526 with a proposed patch. I am not sure, whether I got the different compiler macros right, though, since I do not have access to the compilers they are intented for. Furthermore you may want to enclose the std::tuple stuff (including namespace helper) into a macro, which enables it if C++11 is used (I presume such a macro does already exist, but I did not know its exact syntax).
Great, thanks! I'll try to get to this before 1.53.0 is released. Did you add a unit test by chance? I wrote one but did not include it in the patch. Do you want a simple source file or is there a boost template for unit tests?
As for conditioning on the existence of std::tuple, looks like BOOST_NO_CXX11_HDR_TUPLE and BOOST_HAS_TR1_TUPLE would be macros to use. Thanks.
By the way: Is there a way to remove attachments from track tickets? I accidentally attached a non-working patch before actually attaching the working one. Unfortunately I did not manage to remove the wrong attachment. If I start to modify the patch further, I might hit the restrictions of max. space for attachments, if I cannot delete the deprecated ones. Regards Claas

On Thu, Oct 18, 2012 at 6:56 AM, "Claas H. Köhler" <claas.koehler@dlr.de>wrote:
On 18/10/12 15:00, Jeffrey Lee Hellrung, Jr. wrote:
[...]
Great, thanks! I'll try to get to this before 1.53.0 is released. Did you add a unit test by chance?
I wrote one but did not include it in the patch. Do you want a simple source file or is there a boost template for unit tests?
A patch on the existing zip_iterator unit test would suffice. Btw, there appears to be additional activity on the ticket, with patches to make zip_iterator work for any Boost.Fusion sequence of iterators (which seems reasonable).
As for conditioning on the existence of std::tuple, looks like BOOST_NO_CXX11_HDR_TUPLE and BOOST_HAS_TR1_TUPLE would be macros to use. Thanks.
By the way: Is there a way to remove attachments from track tickets? I accidentally attached a non-working patch before actually attaching the working one. Unfortunately I did not manage to remove the wrong attachment. If I start to modify the patch further, I might hit the restrictions of max. space for attachments, if I cannot delete the deprecated ones.
Sorry, I can't figure out how to delete attachments either :( - Jeff
participants (3)
-
"Claas H. Köhler"
-
Giovanni Piero Deretta
-
Jeffrey Lee Hellrung, Jr.