Modify

Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#6212 closed Bugs (fixed)

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

Reported by: ne01026@… Owned by: Neil Groves
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 (0)

Change History (5)

comment:1 Changed 6 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 5 years ago by Nathan Ridge

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 5 years ago by Nathan Ridge

Resolution: fixed
Status: newclosed

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

comment:4 Changed 5 years ago by Nathan Ridge

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 5 years ago by Nathan Ridge

(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).

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Neil Groves.
The resolution will be deleted.

Add Comment


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

 
Note: See TracTickets for help on using tickets.