Boost logo

Boost :

From: (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:

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

class function_object_type {
    void operator()() const {}

void f() {
    const function_object_type const_function_object;
    boost::function<void()> function(boost::ref(const_function_object));
    assert(<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:<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:

Take Surveys. Earn Cash. Influence the Future of IT
Join's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
Boost-bugs mailing list

Boost list run by bdawes at, gregod at, cpdaniel at, john at