|
|
This thread is locked; no one can reply to it.
|
1
2
|
| Discussion Thursdays? |
|
alethiophile
Member #9,349
December 2007
|
Actually I haven't. I don't use C++; I only know it to the extent that it's based on C. -- |
|
Vanneto
Member #8,643
May 2007
|
Well if you are interested here is a nice entry in C++ FAQ Lite. In capitalist America bank robs you. |
|
Edgar Reynaldo
Major Reynaldo
May 2007
|
Quote: How does that std::swap work? It shouldn't be able to swap variables in the calling context without getting pointers to them, unless C++ is much weirder than I thought. A reference works like a pointer, but acts like an object. mingw/include/c++/3.4.5/bits/stl_algobase.h lines 114 - 133
That's just one of many swaps though, but it's possible they mostly just use that one in varying ways - grep for swap in your compiler include directory. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
|
Wetimer
Member #1,622
November 2001
|
One way to use bits in numbers is as a set. Suppose that you have ten items and want to represent subsets of those items. Simply use the first ten bits of an int, where 1 means its included and 0 means it is not included. To check if a particular item is included subset_flags & (1 << index) Flip it using subset_flag ^= (1 << index) However, the neatest part is iteration for(int subset = 0; subset < ( 1 << count_of_items_in_set);subset++) This will iterate through all possible subsets. But due to nature of order through which it will go through the possiblities, for every set under consideration, all possible subsets will have already undergone consideration. I.e. for the subset 1101 All of the following are before it: 1100 <code>if(Windows.State = Crash) Computer.halt();</code> |
|
Sol Blast
Member #9,655
April 2008
|
Topic's been dead for a few days I know, but I'll stick to with the plan anyway There was alot of good reading in this so far. It seems that a few folk learnt something, so the thread is working Either way however, the topic changes tomorrow. Has anyone got any suggestion for a new one they feel there's plenty of dicussion potential in? |
|
weapon_S
Member #7,859
October 2006
|
Maybe you already noticed I tried to make a wiki entry under "bitwise operators". |
|
Sol Blast
Member #9,655
April 2008
|
Ahh, I seen that topic but i never noticed it was related to this topic haha. One idea I had been thinking about for discussion this week is function pointers. Any objections or better ideas? |
|
Thomas Harte
Member #33
April 2000
|
Will you be just carrying on this thread or starting a new one? Without wanting to say anything of them before Thursday, I can think of at least five things to say about function pointers... [My site] [Tetrominoes] |
|
Sol Blast
Member #9,655
April 2008
|
Wonderful. I look forward to hearing them I wasn't so sure about whether to start a new thread or not though. |
|
Vanneto
Member #8,643
May 2007
|
1 Thread once a week is definitely not spammy. Open up a new thread to avoid confusion and mixing up subjects. In capitalist America bank robs you. |
|
Sol Blast
Member #9,655
April 2008
|
Thy will be done |
|
|
1
2
|