Opened 16 years ago
Last modified 14 years ago
#736 closed Bugs (fixed)
Const correctness violation — at Version 2
Reported by: | Douglas Gregor | Owned by: | Douglas Gregor |
---|---|---|---|
Milestone: | Component: | function | |
Version: | None | Severity: | Problem |
Keywords: | Cc: |
Description (last modified by )
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
Change History (2)
comment:1 by , 15 years ago
Owner: | changed from | to
---|---|
Severity: | → Problem |
Status: | assigned → new |
comment:2 by , 15 years ago
Description: | modified (diff) |
---|---|
Owner: | changed from | to
Status: | new → assigned |
Note:
See TracTickets
for help on using tickets.
Assigned to "doug_gregor" instead of nonexistent user "dgregor"