« first day (173 days earlier)      last day (4793 days later) » 

8:36 PM
sick :(
 
Xeo
Hey, anyone got the paper on overloading operator->* handy?
 
@DeadMG You're sick? :(
@Xeo What do you mean?
 
@GMan: Being sick is all I've bitched about for the last three months :P
 
@DeadMG Well I always miss it. :)
 
Xeo
@GMan someone wrote a paper on overloading said operator, sometime in 1995 or so, and I had a link to the pdf, but I can't seem to find it
 
8:45 PM
well let me catch you up
 
@Xeo Ah. Too bad search engines seem to not want to support symbols.
 
I'm very sick, have an extremely restricted diet, and my doc gave me a stronger prescription, but I have serious doubts that it's helping
 
What happens when it doesn't get better? :/
 
@DeadMG You been to a specialist?
 
@Tony: No
@GMan: Fuckin', I've no idea
can't live like this for a long time, seriously, it's the most inconvenient thing ever
 
8:47 PM
@DeadMG perhaps that's something to consider
 
@DeadMG :( Sorry to hear it.
 
yeah
if I knew where to fin d a specialist, I might
because this is starting to drive me nuts
 
well, maybe Google can help
not sure what these people are called
its the stomach right?
 
bowel
 
not sure if you'd call it a Gastroenterologist, one who specializes in Gastroenterology
 
8:52 PM
ugh
 
yea, well I know, but if it doesn't get better you to do something, doing nothing is not gonna help you
 
hey, I was at the doc's not ten days ago
much fuckin' good it's done me
 
I've also had plenty of medical problems, so I know
yes, but he's a MD right? so he's not necessarily fully educated in all things everywhere
 
yeah
there is that
he keeps sending me away with two-month prescriptions
maybe I'm missing something here, but I feel that problems should resolve themselves within a few weeks at most, if they don't require direct medical intervention as a cure
 
it's never a bad idea to get a second opinion, if only that
 
8:55 PM
yeah
but where would I go? if I get an appt from my registered place, I'm just gonna get the same guy again
 
@DeadMG you're right, but you've been struggling with it for quite a bit, so that's why I am suggesting what I've been saying
 
yeah
 
@DeadMG find somewhere else to go, not sure how easy that is with the UK medical system, but it should be possible nevertheless
for my whole life I've seen nothing but doctors and surgeons and specialists, and I totally get the feeling that you get when they just don't resolve the issue, so that's why if one doesn't resolve it, you should go find out from a totally independent source what he thinks... if it's the same, then possibly the other guy was right, if not, be suspicious
 
well, as far as I know, you have to be registered somewhere to get an appointment there
 
@DeadMG that is FAIL...
maybe you should try private sector?
 
9:00 PM
@DeadMG in what country do you live?
 
my father does have private medical insurance and it does cover me
UK
 
@DeadMG so go for it then
asking advice can not make you worse
 
yeah
there is that
 
@DeadMG I'm only trying to help, but at the end of the day you have to do what you think is right for you.
 
yeah, of course
I might speak to him about it tomorrow
 
9:03 PM
@DeadMG I'm like that. There's a problem, there's a solution, but for some reason I never seem to bother fixing the problem... Unless it becomes too severe..
 
yeah, except for the part where he's actually kinda busy right now
 
@StackedCrooked I did that once and it almost ended me in a wheelchair for the rest of my life.... not always a good idea
 
so what happened to you Tony?
 
@DeadMG Why a few weeks at most?
 
@Tony I'm in a wheelchair currently, actually, a desk chair with little wheels under it.
@Tony Sorry, my disability is now knowing how to respond normally. :/
 
9:05 PM
@GMan: My mother had the same symptoms, give or take
after six weeks they were going to start testing for cancer
of course, cancer and such is much rarer in people of my age
 
Yeah.
 
@DeadMG born with a defect on the lower limbs, used them too much and the pain got soo bad that I could hardly walk anymore... had operation... now 2 years later, still on crutches... if I had ignored it much longer, walking would've been totally over for me
 
but, if I had an infection, then in three months, I should have been able to defeat it on my own
 
@StackedCrooked no worries :)
 
@Tony Thanks :)
 
9:09 PM
block caret is a bitch
just saying
 
Xeo
Hm. Overloading operator->* with variadic templates sure is easy...
 
fucker
I want variadic templates
 
@Xeo Someone would be Scott Meyers I think, and you can probably search back in the chat, sbi added a link a few days ago
 
Xeo
@DavidRodríguezdribeas Thanks! :)
 
@DavidRodríguezdribeas What are you referring to? If I may ask? :)
 
9:23 PM
Well, someone asked on overloading operator->* a few days ago, and sbi added a link to a rather old article on the matter, which was the only thing he could find in literature
Xeo just asked for the article, and I provided as much info as I have...
 
There is an operator called "operator->*" ?
 
Xeo
yes
for pointer-to-members
 
It's not the same as "operator->" ?
 
no
although it really should be
honestly
 
How do you pronounce it?
I recently learned that operator[] is called subscript operator.
So I figure -> and ->* must also have names?
Google is pretty much useless when search for information about "operator->*"
Damn C++ ascii art
 
9:26 PM
they do
can't recall them, but they do
 
deref operator? is my guess
 
-> is arrow for the graphical representation... then I guess ->* could be called bullseye, or maybe Robin Hood
2
 
Xeo
found it, but not in the chat :)
though it's not the pdf, only the src
 
operator-> is the "class-member access" operator.
 
9:29 PM
operator->* and operator.* are pointer-to-member operators.
 
@GMan According to Wikipedia it is named: "Member b of object pointed to by a". Doesn't seem right.
 
Yeah, those are descriptions, not names.
(i.e. they're wrong.)
 
Xeo
ha, pdf found~
 
You can call it as you want... but last time I met operator->* in a bar he introduced itself as Robin Hood. Then again we were both drunk, and everybody knows that you cannot trust a drunk operator...
 
For those who are bored and in for some giggles: reddit.com/r/AskReddit/comments/gjyz6/…
Ok, C++ question: which datatype do you use when iterating a std::vector or std::string in a for loop? int, unsigned int, size_t, std::size_t, std::vector<T>::size_type, ...? Or do you always use an iterator (out of "principle")?
 
9:43 PM
BOOST_FOREACH. ;)
(Iterators.)
 
@GMan Interesting, haven't really used that one yet..
Brb, rebooting
 
for (auto b = v.begin(), e = v.end(); b != e; ++b) { auto& e = *b; /* use e */ } This is the idea behind Boost.ForEach.
 
Do you 'cache' the e variable because you want to avoid multiple calls to the end() method?
 
@StackedCrooked The call itself will be inlined, but the evaluation could be expensive; no point for something that's not changing.
end() could be implemented as return begin() + size();. Cheap, possibly provably the same for the compiler (that is, it can cache it for us), but no use guessing about it.
 
@GMan Cool
 
9:51 PM
Depending on the STL implementation it might even be available as-is. For example, in the g++ STL implementation (I would have to check Dinkumware, but I believe they do the same), a vector is represented by three pointers: begin, end, end_of_capacity
 
so size() returns (end - begin) ?
 
The most interesting part of BOOST_FOREACH (from my point of view) is not the loop, but the variable injection, how to create that auto& e equivalent inside the braces...
(actually the type is user provided)
@StackedCrooked yep
 
@DavidRodríguezdribeas I remember a litb post that did some cool stuff using the initializer expression of the for loop
and he got the idea from BOOST_FOREACH if I remember well. Unfortunately I can find that post again :/
 
I haven't looked, but my guess would be it does something like this: for( /* magic */ ) if (var = *iter, false) else
Where var is the first parameter to the macro.
 
@GMan Yeah, something like that. Pretty crazy..
 
9:56 PM
I don't remember the whole details, but you it implied two for loops and an if
 
Things like this ... make C++ such a weird language :)
 
// pseudo code
FOR_EACH( type& x, container ) { USER_CODE }

for ( iterator<container>::type it = container.begin(), end = container.end(); it != end; ++it )
if ( bool x = false ) {} else
for (type & x = *it; !x; x = true )
{ USER_CODE }
 
@DavidRodríguezdribeas Oh, that looks right. I forgot about break/continue.
 
std::for_each(v.begin(), v.end(), [](decltype(*v.begin())& ref) {
});
 
10:00 PM
Polymorphic lambda's, where are you? :(
And ranges!
 
Oh, the yearning...
 
std::for_each(all(v), [](auto& ref) {});
 
I once wrote one based on M4, just for fun:
define(`FOREACH', `for (int _idx = 0; _idx != $1.size(); ++_idx)
{
$2 = $1[_idx];
$3
}')
 
@GMan is it right? I think I am missing some code to handle break
 
@DavidRodríguezdribeas Oh, right again. It handles continue. Lemme think.
Wait, no, that is right.
 
10:03 PM
If it was not for the fun, it is probably simpler to just look at the result of the macro expansion :)
 
break will only break from the inner loop.
 
@DavidRodríguezdribeas Ha, g++ -E, recently found out how useful that is
 
@StackedCrooked Try that with a simple use of BOOST_FOREACH, and then try reading the output :P
 
It hides most of the details.
 
It's become crazier with time, I thought it was crazy enough a couple of years ago, when it resembled the pseudo code I posted... now the structure is:
if (A) {} else if (B) {} else if (C) {} for (D) if (E) {} else for (F)
Where A creates an auxiliary variable only used in B and C, B and C create the current and end iterators, D creates a continue bool that is test and unset in E and does the advance of the iterator, while F creates the actual variable (argument to the macro) and sets the continue bool
If user code calls break, the continue variable will not be reset in the step of the F loop, and the condition in D (continue && done( current, end )) will fail, breaking out of both the inner and outer loops...
Makes sense :D
 
10:22 PM
D:
 
BOOST_FOREACH( int& x, array ) expands to only 2931 characters...
This version has interesting magic... ( true ? 0 : foo( ... ) )
 
yeah
 
So: the input file is:
 
it's to do with rvalues
 
After preprocessign:
typedef std::set<std::string> Entries;

int main()
{
Entries entries;
entries.insert("one");
entries.insert("two");
entries.insert("three");
entries.insert("four");
entries.insert("five");

if (boost::foreach_detail_::auto_any_t _foreach_col17 = boost::foreach_detail_::contain( (entries) , (true ? 0 : boost::foreach_detail_::or_( boost::foreach_detail_::and_( boost::foreach_detail_::not_(boost::foreach_detail_::is_array_(entries)) , (true ? 0 : boost::foreach_detail_::is_rvalue_( (true ? boost::foreach_detail_::make_probe(entries) : (entries)), 0))) , boost::foreach_detail_::and_( boost::fo
 
10:27 PM
if you have an rvalue container, then BOOST_FOREACH will copy it, and not if not
 
#include <set>
#include <string>

typedef std::set<std::string> Entries;

int main()
{
Entries entries;
entries.insert("one");
entries.insert("two");
entries.insert("three");
entries.insert("four");
entries.insert("five");

BOOST_FOREACH(std::string entry, entries)
{
std::cout << "Entry: " << entry << std::endl;
}

return 0;
}
And after preprocessing:
typedef std::set<std::string> Entries;

int main()
{
Entries entries;
entries.insert("one");
entries.insert("two");
entries.insert("three");
entries.insert("four");
entries.insert("five");

if (boost::foreach_detail_::auto_any_t _foreach_col17 = boost::foreach_detail_::contain( (entries) , (true ? 0 : boost::foreach_detail_::or_( boost::foreach_detail_::and_( boost::foreach_detail_::not_(boost::foreach_detail_::is_array_(entries)) , (true ? 0 : boost::foreach_detail_::is_rvalue_( (true ? boost::foreach_detail_::make_probe(entries) : (entries)), 0))) , boost::foreach_detail_::and_( boost::fo
 
the ?: stuff detects whether or not something is an lvalue or an rvalue in C++0x
C++03, even
 
Not very readable...
 
@DavidRodríguezdribeas @StackedCrooked You can read about what @DeadMG is talking about here: Conditional Love: FOREACH Redux
 
10:34 PM
14
Q: Please help me remove the BUG from this code

ShankarGuys, I have had sleepless nights trying to remove the bug from this code. Please help me out! #################################################### #include < stdio.h > #define LAST 10 int main() { int i, sum = 0; for ( i = 1; i < = LAST; i++ ) { sum += i; } ...

LOL
 
@GMan That's pretty sick..
In a good way :)
 
@StackedCrooked Haha, yeah.
 
No, it is not sick it is GREAT...
It's interesting, over two years ago I looked at BOOST_FOREACH and it was awesome, and now I look and it is awesome-er
 
Haha. C++, you crazy.
 
There should be list of exercises on this topic, so that you can become more familiar with the concepts gradually.
@Mahesh That's funny.
 
11:13 PM
@DavidRodríguezdribeas I used to have BOOST_FOREACH all over the place, up until the point where I noticed that every instance of this macro means several kb bigger binary, comparing to plain for(;;). I'm not sure if that's a one time cost (per a combination of types used), or if it adds up to infinity -- never really looked into it, but I'm using them sparingly now.
 
11:26 PM
question for those who the spec too well, are member variables of a class actually defined using that term? does the spec give any guidance as what case should be used for them?
 
11:44 PM
@thecoshman The standard uses the term "data members".
 
oh thanks
How does this relate variables in the spec. I know this is being pedantic but trying to convince a friend that variables should always be lower case, even variables with in a class
 
sbi
@GMan You miss being sick?!
@Xeo The paper on overloading operator->*? The only one I know about is by Scott Meyers. No doubt you'll find it at his website, aristeia.com. Don't get lost there. He's got a lot of interesting articles.
@DavidRodríguezdribeas Was that really in the chat? ISTR this having been on SO proper. ICBWT.
@Xeo Ah, Ok. Well, I guess I should learn to read everything before posting...
Oh, and @Xeo, BTW:
14 hours ago, by sbi
However, one thing keeps irking me: @Xeo didn't show up, so I couldn't check on her sex. I think this gives us a real, big incentive to keep up the fun about her trying to convince us she's male.
 

« first day (173 days earlier)      last day (4793 days later) »