signature discrepancy between equal_range and upper_bound

The algorithm equal_range takes the Value by constant reference while the algorithm upper_bound takes Value by value. Why is that? (Note that standard algorithms take a constant reference.)

On Tue, Dec 6, 2011 at 5:34 AM, <giecrilj@stegny.2a.pl> wrote:
The algorithm equal_range takes the Value by constant reference while the algorithm upper_bound takes Value by value. Why is that? (Note that standard algorithms take a constant reference.)
Sorry to be obtuse, but... are you talking about a Boost library? If so, which one?

Re: signature discrepancy between equal_range and upper_bound
From: Nat Linden <nat@lindenlab.com> Reply to: boost-users@lists.boost.org Date: Tue, 6 Dec 2011 08:58:18 -0500 Newsgroups: gmane.comp.lib.boost.user Followup to: newsgroup References: <jbkr2p$hi$1@dough.gmane.org> On Tue, Dec 6, 2011 at 5:34 AM, <giecrilj@stegny.2a.pl> wrote:
The algorithm equal_range takes the Value by constant reference while the algorithm upper_bound takes Value by value. Why is that? =A0(Note that standard algorithms take a constant reference.)
Sorry to be obtuse, but... are you talking about a Boost library? If so, which one?
<URL: file:///usr/share/doc/packages/boost-1.44.0/libs/range/doc/html/range/reference/algorithms/non_mutating/upper_bound.html >

On Dec 6, 2011, at 11:17 AM, giecrilj@stegny.2a.pl wrote:
Re: signature discrepancy between equal_range and upper_bound
The algorithm equal_range takes the Value by constant reference while the algorithm upper_bound takes Value by value. Why is that? =A0(Note that standard algorithms take a constant reference.)
Sorry to be obtuse, but... are you talking about a Boost library? If so, which one?
<URL: file:///usr/share/doc/packages/boost-1.44.0/libs/range/doc/html/range/reference/algorithms/non_mutating/upper_bound.html >
I think what the OP is saying is that in the STL, we have: equal_range ( ForwardIterator first, ForwardIterator last, const T& value ); and upper_bound ( ForwardIterator first, ForwardIterator last, const T& value ); but in Boost.Range, we have: equal_range ( Range &r, const T& value ); and upper_bound ( Range &r, T value ); And he's wondering why boost::range::upper_bound takes its' parameter by value. Is that correct? -- Marshall Marshall Clow Idio Software <mailto:mclow.lists@gmail.com> A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait). -- Yu Suzuki

Re: [range] signature discrepancy between equal_range and upper_bound
From: Marshall Clow <mclow.lists@gmail.com> Reply to: boost-users@lists.boost.org Date: Tue, 6 Dec 2011 11:29:34 -0800 Newsgroups: gmane.comp.lib.boost.user Followup to: newsgroup References: <CAKQaxCbWWuKALddDmMp4MpOCDOBOFXNpDgpJQGPAErVu7=WN4g@mail.gmail. com> <jblpnr$91o$1@dough.gmane.org> On Dec 6, 2011, at 11:17 AM, giecrilj@stegny.2a.pl wrote:
I think what the OP is saying is that in the STL, we have: equal_range ( ForwardIterator first, ForwardIterator last, c onst T& value ); and upper_bound ( ForwardIterator first, ForwardIterator last, c onst T& value );
but in Boost.Range, we have: equal_range ( Range &r, const T& value ); and upper_bound ( Range &r, T value );
And he's wondering why boost::range::upper_bound takes its' parameter by value.
Is that correct?
I wonder why boost ::range ::upper_bound takes its parameter by value. Chris
participants (3)
-
giecrilj@stegny.2a.pl
-
Marshall Clow
-
Nat Linden