Boost logo

Boost :

From: SourceForge.net (noreply_at_[hidden])
Date: 2006-09-29 11:30:55


Bugs item #1567821, was opened at 2006-09-29 11:30
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=107586&aid=1567821&group_id=7586

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: function
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Douglas Gregor (dgregor)
Assigned to: Douglas Gregor (dgregor)
Summary: Const correctness violation

Initial Comment:

Boost.Function does not preserve const correctness for reference
wrappers
e.g.

class function_object_type {
  public:
    void operator()() const {}
};

void f() {
    const function_object_type const_function_object;
    boost::function<void()> function(boost::ref(const_function_object));
    assert(function.target<function_object>() ==
&const_function_object); //const lost
}

I can see two possible solutions for this:

    add a flag:
    enum cv_qualifiers { const_ = 1, volatile_ = 1 << 1};

    or don't unwrap references for target:
    function.target<boost::reference_wrapper<function_object> >()

The first method seems preferable because it doesn't
require the interface to change.

In Christ,
Steven Watanabe

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=107586&aid=1567821&group_id=7586

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-bugs mailing list
Boost-bugs_at_[hidden]
https://lists.sourceforge.net/lists/listinfo/boost-bugs


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk