|
This thread is locked; no one can reply to it. |
1
2
|
operator++(bool) |
Arthur Kalliokoski
Second in Command
February 2005
|
Write out your truth table and all possible outcomes (4 of them). They all watch too much MSNBC... they get ideas. |
GullRaDriel
Member #3,861
September 2003
|
torhu said: Fuck Matthew Leverton, just fuck him. Bad thread ? "Code is like shit - it only smells if it is not yours" |
Bruce Perry
Member #270
April 2000
|
Arthur, the operator needs to return the old value of the variable from before it was set to true. For example: bool munge(bool &x) { return x++; } That function will set x, but it will also return x's old value. To do that, it has to copy it. Granted the compiler could optimise that away if the x++ appears as a statement with its value unused. -- |
Andrei Ellman
Member #3,434
April 2003
|
Bruce Perry said: That function will set x, but it will also return x's old value. To do that, it has to copy it. Now, if x is some large class with an overloaded '++' operator, ++x and x++ can make all the difference, as copying would take longer. -- |
Johan Halmén
Member #1,550
September 2001
|
{"name":"609921","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/a\/8a20a909009bfcd5bfee645bece22df7.png","w":474,"h":474,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/a\/8a20a909009bfcd5bfee645bece22df7"} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest. |
bamccaig
Member #7,536
July 2006
|
-- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
|
1
2
|