Modify

Ticket #6212 (closed Bugs: fixed)

Opened 2 years ago

Last modified 16 months ago

"Method 3.1: Implement a Range Adaptor without arguments" does not implement

Reported by: ne01026@… Owned by: neilgroves
Milestone: To Be Determined Component: range
Version: Boost 1.48.0 Severity: Problem
Keywords: Cc:

Description

The sample code in  Method 3.1: Implement a Range Adaptor without arguments is incomplete; it does not provide for the syntax range | ::boost:: adaptors:: reversed.

Attachments

Change History

comment:1 follow-up: ↓ 2 Changed 2 years ago by ne01026@…

It turns out that the following code is needed to finish up:

namespace
        {
            const detail::reverse_forwarder reversed = 
                                            detail::reverse_forwarder();
        }

I wonder why the explicit assignment is needed? Or should it be a reference instead?

comment:2 in reply to: ↑ 1 Changed 16 months ago by nathanridge

Replying to ne01026@…:

I wonder why the explicit assignment is needed? Or should it be a reference instead?

It should not be a reference (it would be a reference to a temporary which will have died long before one tries to use it).

Regarding why the explicit assignment is needed, see  http://stackoverflow.com/questions/8092670/uninitialized-const. I believe

    const detail::reverse_forwarder reversed = {};

also does the trick.

comment:3 Changed 16 months ago by nathanridge

  • Status changed from new to closed
  • Resolution set to fixed

(In [82314]) [range] fixed #6212 (missing step in documentation for how to write a range adaptor)

comment:4 Changed 16 months ago by nathanridge

Fixed in trunk. The fix will appear in 1.53 (I will merge to release branch after 1.53 beta release).

Thanks for the report!

comment:5 Changed 16 months ago by nathanridge

(In [82487]) [range] Merge documentation fixes and minor refactoring of docs (refs #5160; refs #5314; refs #5440; refs #5775; refs #6212; refs #7585; refs #7843; refs #7866).

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.