Opened 12 years ago

Closed 12 years ago

#4548 closed Bugs (fixed)

typo in factory documentation example code

Reported by: Erik Sjölund <erik.sjolund@…> Owned by: t_schwinger
Milestone: Boost 1.44.0 Component: functional/factory
Version: Boost 1.44.0 Severity: Problem
Keywords: Cc:

Description

At this page: http://www.boost.org/doc/libs/1_44_0/libs/functional/factory/doc/html/index.html

this line seems wrong:

std::auto_ptr<an_abstract_factory> x = factories[some_name]->create();

I think it should be:

std::auto_ptr<an_abstract_class> x = factories[some_name]->create();

cheers,
Erik Sjölund

Attachments (1)

fix-factory-html-bug.patch (1.3 KB ) - added by Erik Sjölund <erik.sjolund@…> 12 years ago.

Download all attachments as: .zip

Change History (3)

by Erik Sjölund <erik.sjolund@…>, 12 years ago

Attachment: fix-factory-html-bug.patch added

comment:1 by Steven Watanabe, 12 years ago

This example is wrong for any number of reasons:

  • It requires an illegal implicit conversion from a pointer to an auto_ptr.
  • It attempts to create an object of an abstract class a_factory (in ptr_map::operator[])
  • It treats the result of factories[some_name] as a pointer. It should be a reference.

comment:2 by Steven Watanabe, 12 years ago

Resolution: fixed
Status: newclosed

(In [71064]) Make sure this example compiles. Fixes #4548.

Note: See TracTickets for help on using tickets.