Ticket #4779 (closed: fixed)
Make Mantid compilable with c++11 (c++0x) option enabled in gcc
Reported by: | Russell Taylor | Owned by: | Russell Taylor |
---|---|---|---|
Priority: | trivial | Milestone: | Release 2.1 |
Component: | Mantid | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Tester: | Martyn Gigg |
Description
A few minor changes are required for compilation to succeed with the -std=c++0x argument to gcc. They will not break the ability to build without this option.
The Intel compiler has the same option available, but it uses the gcc standard library. On the mac this means version 4.2.1, which pre-dates any c++11 changes, so the code already compiles without changes.
Change History
comment:2 Changed 9 years ago by Russell Taylor
No return-by-reference overload for std::complex::imag() in c++11.
This reworks the code to avoid the attempt to use such a method, and simplifies it as well by losing the #defines. Re #4779.
Changeset: 2409c6a77bb5c74079195b06fc8c9170b24d17d2
comment:3 Changed 9 years ago by Russell Taylor
Get around changes to std::pair constructor in GCC C++11. Re #4779.
This relates to the introduction of perfect forwarding constructors. It's not hard to work around this with code that should still work everywhere.
Changeset: 948341d7e62123b94aea55201925d388143f5711
comment:4 Changed 9 years ago by Russell Taylor
Small fix so that flags can be customized locally. Re #4779.
Changeset: 3f89d5fa35e2a975402ef114bd3721b28693c7b6
comment:5 Changed 9 years ago by Russell Taylor
Try to fix gcc 4.6.1 build (fedora 15). Re #4779.
Seems that this specific version of gcc (but no other) cannot choose between the copy and move constructors at this point.
Changeset: 13c6d347ce99eccd2547df0394637c069654748a
comment:6 Changed 9 years ago by Russell Taylor
A number of commits failed to make it into here:
- Turn on the c++0x flag for the gcc & intel compilers. ba6099ec22b0198b4d5bc2a261ccb5110bbb5d08
- Small changes to make sure the flag is being picked up. 10e0fc6c62729b21be2b622c26257801e90ee2e5
- Restore warning avoidance. a218903000ac741e0c6caa1d1c0794c56520935f
- Try to fix the unsupported platforms. 7c225cae28d9d76f4f77ba81732782b1ace4f0c4
- Try to fix the unsupported platforms. 4b67bccf46fb0dc8a2d75091bf9c74f23211d378
comment:7 Changed 9 years ago by Russell Taylor
Clean up an unnecessarily ugly line. Re #4779.
Changeset: 3ee0ee9176be7655e9ec89406ee4f025cc64ba2b
comment:8 Changed 9 years ago by Russell Taylor
- Status changed from accepted to verify
- Resolution set to fixed
To test: make sure that the flag is present when building (use make VERBOSE=1 to see if --std=c++0x is there) and that the builds are succeeding - which they would not if the second change under comment:6 is still there.
comment:9 Changed 9 years ago by Russell Taylor
Clean up an unnecessarily ugly line. Re #4779.
Changeset: 3ee0ee9176be7655e9ec89406ee4f025cc64ba2b
comment:10 Changed 9 years ago by Russell Taylor
Use emplace_back to avoid copy constructor call for every event.
The previous commit (dd887c9) actually won't help because TofEvent is not movable (it uses composition). This change does, though only gcc implements it so far. That's the theory, but I have to admit I can't see a difference in run time. Re #4472, Re #4779.
Changeset: e87a472294ea8de6b3685aa7d3b8a47fc6eb3aed
comment:11 Changed 9 years ago by Russell Taylor
Use emplace_back to avoid copy constructor call for every event.
The previous commit (dd887c9) actually won't help because TofEvent is not movable (it uses composition). This change does, though only gcc implements it so far. That's the theory, but I have to admit I can't see a difference in run time. Re #4472, Re #4779.
Changeset: e87a472294ea8de6b3685aa7d3b8a47fc6eb3aed
comment:12 Changed 8 years ago by Martyn Gigg
- Status changed from verify to verifying
- Tester set to Martyn Gigg
comment:13 Changed 8 years ago by Martyn Gigg
We've got c++11 usage dotted around now and all the linux builds are fine.
comment:15 Changed 5 years ago by Stuart Campbell
This ticket has been transferred to github issue 5626