Bug 93243 - replace boost::bind with C++11 lambdas
Summary: replace boost::bind with C++11 lambdas
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
5.1.0.0.alpha0+ Master
Hardware: Other All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard: target:5.3.0
Keywords: difficultyBeginner, easyHack, skillCpp, topicCleanup
Depends on:
Blocks:
 
Reported: 2015-08-07 14:10 UTC by Michael Stahl (allotropia)
Modified: 2017-02-14 08:57 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Stahl (allotropia) 2015-08-07 14:10:09 UTC
boost::bind is used to create function objects.

the bundled boost headers require a lot of patches to suppress warnings
so it would reduce the maintenance burden here to use standard C++11
features instead, and it would also make incremental rebuilds faster
whenever boost is modified/patched.

C++11 has both built-in lambda syntax to create function objects,
and std::bind in <functional> which is very similar to boost::bind.

the C++11 lambdas have the advantage that they are built-in
syntax so are the fastest to compile; they are also often
easier to read in the more complex nested boost::bind cases.

there is one obscure pit-fall here: in very rare cases the function is
passed as an argument to a preprocessor macro.  lambdas may not work
in this case because the preprocessor interprets commas in the
capture list as macro argument separators and compilation fails.
use std::bind in such cases.

to find the offending code just "git grep boost::bind"
Comment 1 n.r.pearson 2015-09-04 17:33:22 UTC
working on it
Comment 2 Björn Michaelsen 2015-09-04 17:36:55 UTC
no need to self-assign: multiple contributors can work on this in parallel without collisions
Comment 3 Commit Notification 2015-09-09 08:12:20 UTC
Albert Thuswaldner committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=083c865f9af70a12dfed52b07785e303eb61b397

tdf#93243 replace boost::bind with C++11 lambdas in drawsh2.cxx

It will be available in 5.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 4 Commit Notification 2015-09-10 07:49:16 UTC
n.r.pearson committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=fa4871b7436c159c9d206d910f899d8af3044d72

tdf#93243 replace boost::bind with C++11 lambdas in unoshape.cxx

It will be available in 5.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 5 Commit Notification 2015-09-11 13:43:25 UTC
n.r.pearson committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=ab4bb0c0dd74a537a7e7cba5b0d21e2b9d57c8b3

tdf#93243 replace boost::bind with C++11 lambdas in Metadatable.cxx

It will be available in 5.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 6 Commit Notification 2015-09-29 06:58:37 UTC
n.r.pearson committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=92ffd0acea035dc3916fc001b4dcd901a8a7a9d2

tdf#93243 replace boost::bind with C++11 lambdas in SidebarController.cxx

It will be available in 5.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 7 Commit Notification 2015-10-05 06:20:48 UTC
Albert Thuswaldner committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=7d82dfca4d78841930a4411371c3d211badeccdb

tdf#93243 replace boost::bind with C++11 lambdas in excimp8.cxx

It will be available in 5.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 8 Commit Notification 2015-10-09 07:21:29 UTC
Albert Thuswaldner committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d5dc2a2a726dd151fb30fae25478511dce929dfa

tdf#93243 replace boost::bind with C++11 lambdas Cell...PropertyPanel.cxx

It will be available in 5.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Commit Notification 2015-10-11 06:16:57 UTC
Daniel Robertson committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=91e0161dc5a0de0dcce1696aea318d919d5d04a1

tdf#93243 slideshow: replace boost::bind

It will be available in 5.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Commit Notification 2015-10-13 08:06:34 UTC
Daniel Robertson committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=4038b27a0be01fbf6eab9b28cfe00f29e8eba1b7

tdf#93243 slideshow: boost::bind -> C++11 lambdas

It will be available in 5.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Commit Notification 2015-10-15 06:24:46 UTC
Daniel Robertson committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=39c7826c814fb8043942f5d9e1f1f049641865e8

tdf#93243 slideshow: boost::bind -> C++11 lambdas

It will be available in 5.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 Commit Notification 2015-10-22 15:42:04 UTC
Sahas committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d50fa33c6b9bf65cd884090a45ad917aadb7c674

tdf#93243 - replaced some boost::bind with C++11 lambdas

It will be available in 5.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 13 Commit Notification 2015-11-01 11:22:27 UTC
Fabio Buso committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=76e75d2dd6dafe55fd1740693529640652ed6455

tdf#93243 replace boost::bind with c++11 lambdas in toolkit/

It will be available in 5.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 14 Commit Notification 2015-11-11 10:11:58 UTC
Fabio Buso committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=c21ddcdb30b8dd7be56176e00bc2d4780cb342e1

tdf#93243 replace boost::bind with c++11 lambdas in vcl/source tree

It will be available in 5.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 15 Robinson Tryon (qubit) 2015-12-13 11:04:06 UTC Comment hidden (obsolete)
Comment 16 Robinson Tryon (qubit) 2016-02-18 14:51:27 UTC Comment hidden (obsolete)
Comment 17 jani 2016-04-20 06:08:21 UTC
The following openwork search, gives the missing places:

http://opengrok.libreoffice.org/search?q=boost%3A%3Abind&project=core&defs=&refs=&path=&hist=
Comment 18 Helena Svobodová 2016-05-08 08:12:44 UTC
Hello,

I would like to participate on this bug. Is it still up to date?

This is my first interaction with LibreOffice. For submitting patches, shall I follow these instructions? https://wiki.documentfoundation.org/Development/GetInvolved

Thank you
Comment 19 jani 2016-05-08 08:50:22 UTC
(In reply to Helena Svobodová from comment #18)
> Hello,
> 
> I would like to participate on this bug. Is it still up to date?
> 
> This is my first interaction with LibreOffice. For submitting patches, shall
> I follow these instructions?
> https://wiki.documentfoundation.org/Development/GetInvolved
> 
> Thank you

Welcome, the bug should be up to date, of course there has been some activity, so you need to look for the places to change.

The GetInvolved page is the "patch to get a patch merged" :-) and are also updated.

Feel free to ping me on the mailing list, if you have problems.

rgds
jan i.
Comment 20 Unknowner21 2016-05-14 14:43:09 UTC
Hi 

I'm working on this bug and i got a question.

in the file  /home/unknowner21/libreoffice2/reportdesign/source/ui/inspection/GeometryHandler.cxx

 I'm trying to change the line number 1639 : 
      ::boost::bind( &DefaultFunction::getName, _1 ));

but the problem is the function getName from DefaultFunction got no parameter and we have the _1 that indicates the first parameter of this function if I'm not mistaken.

can I have some clarification about that ?

thank you
Comment 21 Michael Stahl (allotropia) 2016-05-24 19:07:38 UTC
(In reply to Unknowner21 from comment #20)
> can I have some clarification about that ?

well it needs a parameter then.

as it happens, i've converted this file 2 days before you wrote this comment,
so you can look at this commit for the answer :)

https://gerrit.libreoffice.org/gitweb?p=core.git;a=commitdiff;h=3e61eb69ac1cff727072011e228eabfc8bc055c0

...

actually now there are just 2 files left that use boost::bind,
and both of them are horrible boost::spirit line noise code
which nobody should touch anyway if they want to retain their sanity.

this stuff drives even the most experienced developers to despair,
as can be seen in https://gerrit.libreoffice.org/#/c/21969/3

so i'll close this easy-hack.
Comment 22 Commit Notification 2016-05-26 13:36:04 UTC
Helena Svobodova committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=f90b77d0f27294b00ceb58b21f4d644fa84a3289

tdf#93243 Replacing boost::bind with C++11 lambdas

It will be available in 5.3.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.