« first day (324 days earlier)      last day (4607 days later) » 

1:28 AM
one question, fill(p, p+n, 0) where p is pointer to pointer is invallid, function from algorithm can't work with pointer to pointer ?
the idea was to fill array of pointers to null pointers
dont want to use for loop
 
What is p declared as?
 
in function like reference to **
 
Oh yeah.
Cast 0 to the pointer type you're using.
or use nullptr assuming C++11
Reason 0 doesn't work is type deduction; the call will try to fill the range of pointers with an int.
 
genneraly is it good practice to replace all for loop with fill, for_each, etc...
@Luc Danton, something like this: fill(ref, ref+m, static_cast<double*>(0));
now it's woriking
working*
 
1:47 AM
@Srle Yep.
 
:D
so is it good practice to replace all for loop with fill, for_each, etc... ?
 
If the semantics of the algorithm match what you're doing, it's usually a big win to use it.
The problem is when using C++03; most of the time you need a special functor to do what you want, but due to the rules of the language you must define it out of line.
C++11 removes this restriction and introduces lambda expressions.
 
so it is worth to try :P
 
writing struct explicit_functor_name { typedef T result_type; result_type operator()(T const& lhs, U const& rhs) const { return lhs.quux(rhs); } }; for every algorithm call gets tiring quickly.
 
2:07 AM
any compiler for good support for c++0x ?
 
I abuse GCC regularly.
It has its limits but it can do some things.
Although how well it supports C++11 depends largely on the version, it's in flux a lot.
I'm personally using a snapshot of the upcoming release (4.7).
 
thank you, and good night
 
 
4 hours later…
6:18 AM
@sbi Morning
 
Hi
 
sbi
6:38 AM
http://t.co/xHyBIGK Ideally start with the design pattern you have most recently read about as this is most likely to be the best one
Great, especially some of the comments.
@FredOverflow You read @Cat's words, but you failed to get the point.
 
 
1 hour later…
8:04 AM
Hello gentlemen.
 
Xeo
The fuck?
 
@Xeo What ?
 
Xeo
8:19 AM
I just tabbed back on the SO chat, and instead of the editbox I'm greeted with this text:
> your account has been suspended for posting inappropriate content. You can send messages again in 59 minutes.
Refresh w/ F5 -> works again oO
 
@Xeo There's been a flagging nemesis yersterday
 
Xeo
wtf.
 
you were also suspended, cause of the random flagger that was here yesterday
 
Xeo
I didn't even post anything yesterday iirc xD
 
8:20 AM
someone came in and went through the transcript and flagged everything with "fuck" in it
 
That guy searched for "fuck" in the room's history and flagged them all. lol.
 
basically yea
 
Xeo
oh
I see
 
sbi
@TonyTheTiger You know, having read through yesterday's transcript last night, I wondered why you didn't call a moderator down on that guy and have him banned. I'm sure @balpha would have suspended him for needlessly flagging tons of old messages.
As it is he might wreak havoc now in some other room.
 
This guy is very young. I think he just wanted to play meta police. He even apologized to DeadMG, and said he won't do it again. I think he was honest when he said that.
 
sbi
8:32 AM
@kbok So? If my kids break a window, they are certainly expected to apologize, but that doesn't stop the need to buy a new window.
 
@sbi What do you mean ? Do you except him to repair the chat ? :)
 
sbi
@kbok Seeing your own error must not prevent you from punishment (although I agree that it might soften it).
He did do harm. The way to deal with users doing harm here is to ban them.
 
@sbi I agree. My point was that banning him to prevent him to go spare in another room would have been superfluous, since he will very probably stop doing that.
But I'm with you on the fact that this should meet disciplinary action.
 
sbi
@kbok I am suspicious of that.
Coming here, not knowing this chat, browsing through its history, and doing harm, is about as stupid as it gets. I have a hard time seeing him not knowing the chat as a reasonable excuse for this. From my POV, he should be banned from the chat for a month.
I mean, when you're that determined, would a few people telling you you're doing wrong change your mind?
Anyway, I need to get going. This will be a busy day.
afk
 
sbi
8:53 AM
My inner child fels like playing with matches.
 
if you join this room, you will be in this room. Yay! I am in this room!!!
 
@sbi @balpha did come in here and told him to stop it, but no we didn't ask for him to be banned
 
Who in the world wrote that?
 
> What it does require is that you specify a well defined serialisation binary interface (SBI).
Hehe @sbi.
 
just before i waste time on stupid thing, is there a de facto standard Windows variant of C++11 std::error_category?
 
9:06 AM
boost::error_category?
 
hm, so presumably defining BOOST_WINDOWS_API will get me Windows error messages
but is there something similar in the Holy Standard?
essentially, the q boils down to, is there any way to get Windows error messages via std::error_code?
 
I doubt there is any kind of requirement on the content of the messages.
 
@LucDanton I get POSIX error messages, seems like (in Windows, using Visual C++).
 
At a glance, you'd need to write your own error condition enum, specialize is_error_condition_enum for it, implement make_error_code and/or make_error_condition. Lots of work.
 
9:29 AM
> But Einstein said it was the most powerful force in the universe, and I take all my investment advice from flippant remarks by theoretical physicists making small talk at parties.
 
@sbi haha this is gold
 
9:44 AM
What scares me is the amount of commenters that seem to be taking it seriously.
 
10:16 AM
@RMartinhoFernandes Not referring to Einstein here I assume.
 
No, I'm talking about the "always start with a design pattern" article.
 
@RMartinhoFernandes The Onion once had a piece where most of the available text space was used to point out (to american readers) that THIS IS IRONY. Including the legalese. It was pretty funny, but also scary in a way: I could too easily imagine that being done for real...
 
template <typename T,
    template <typename ELEM,
       typename = std::allocator<ELEM> >
       class CONT = std::deque>
class Stack {}:
how does the std::deque know it has to use T for it's element types here?
 
It doesn't know it there.
In the class body you can instantiate it like this: CONT<T>.
(I think I recognize that code. Reading the Josuttis book?)
 
oh, so until you've done that, it's basically useless
yes
 
10:33 AM
@TonyTheTiger The point is that you can instantiate it with any type you want. You could also do CONT<int> to instantiate a deque of ints.
 
@RMartinhoFernandes oh I see...
hmmm
 
That would require a template template parameter though, not a type one.
i.e. the code is invalid as it is: std::deque is not a type.
 
@LucDanton Read the code again. template <....> class CONT = std::deque.
 
So it is a template template parameter!
 
it compiles
 
10:52 AM
What the heck do you write in a letter of motivation?
"Hi, I'm Martinho, and I applied for the job, because I want it."
 
@RMartinhoFernandes just tell them what interests you about the job, who you are, and you'd have to give them something that gives them a reason to interview you, what sets you apart from others for this job
 
I thought that was what the CV was for, but I never expected this business to make sense, so I guess it's ok.
 
well, the letter is kinda an intro to your CV and something that gives them a reason to even look at your CV
but you don't have to attach it
you could just send your CV
 
That's what I've been doing, but I found one interesting offer that requires it.
 
@RMartinhoFernandes I guess then you'd have to write it ;)
or call em
sometimes that makes a better impression, if you call them directly, just ask about the job and tell them you're interested and then send your CV
does it make sense to have an iterator for a stack?
 
10:59 AM
I really need to stop thinking as if the person doing the selection was me :(
I'd be annoyed if someone called instead of just sending the damn thing.
 
Calling shows interest
even more so then merely a letter
 
@RMartinhoFernandes the CV tells them why you're awesome. It doesn't say that you want the job, or why
 
@TonyTheTiger I don't send CVs to companies or jobs I'm not interested in!
 
@RMartinhoFernandes true that, but calling is just a bit more personal and show's you're more dedicated to getting the job then someone who merely sends an email.
 
@jalf That makes some sense.
Formal writing is really the kind of thing I suck badly at, but I guess it won't hurt to try.
My thoughts are not easy to serialize as formal writing.
Thanks guys.
 
11:12 AM
I'm the chick in the right bottom
 
Can anyone recommend a cheap gaming mouse? I guess Microsoft is a good brand for mouses right?
These are my options: bcc.nl/is-bin/INTERSHOP.enfinity/WFS/bcc-webshop-Site/nl_NL/-/…*%26CategoryUUIDLevelX%252Fx‌​sHAqABQnP8AAAEjXCkV_JiN%252F5W8KA3gMeXcAAAEkOKZF1U0W%3DF2sKA3gMEdkAAAEkR9RF1U1P%2‌​6CategoryUUIDLevelX%252FxsHAqABQnP8AAAEjXCkV_JiN%3D5W8KA3gMeXcAAAEkOKZF1U0W%26Cat‌​egoryUUIDLevelX%3DxsHAqABQnP8AAAEjXCkV_JiN%26Gfkch%2BType%3DPC%2BMuis&SearchCateg‌​oryUUID=F2sKA3gMEdkAAAEkR9RF1U1P&WFSimpleSearch_NameOrID=
woops
 
I don't think "cheap" and "gaming" combine very well.
 
Well compared to the mouse Im having now, anything is better :)
So I just need a mouse with a good dpi, to SUFFICE for gaming. Is 4000dpi ok?
And whats bluetrack technology?
 
I have no idea.
 
11:16 AM
Maybe its like a smurf tracking where your mouse is
 
This is a C++ room, so asking about gaming hardware might not get you answers here
 
Oh shizzle, thought this was the general lounge as well
 
Anyway, I'm more of a keyboard guy. To me a mouse is good if it can point at things.
 
so you prefer Lenovo notebooks as well?
 
11:22 AM
@RMartinhoFernandes yeah, it's horrible. But you kind of just have to play along if you want people to give you a job, unfortunately :p
the whole "why do I want this job" routine is just silly
 
Exactly! Shirley no one will say "I want the job because I need money."
 
@KajToet 1000dpi would be fine, tbh.
 
It's like bootlicking, on paper (or equivalent digital form).
 
@jalf Thanks, I found a MS mouse with 4kdpi supposedly so going for that one. 20 Euros is not much then.
 
@TonyTheTiger An input iterator, yeah.
Err.
Stack? I'm not sure
 
11:24 AM
A stack is not supposed to be iterated over.
 
Well it's not going to be as useful as for a queue (what I recently did) but semantically it doesn't break anything.
 
Unless you make the iterator pop things automatically, but that could be a little surprising.
 
Input iterator to pop, output to push.
 
well, you can talk about what you like to work on, and how your previous experience plays nicely into this specific job
 
hi can anyone help me understanding expressions like `k=i++ * --i * ++i;`.
i dont understand how they are evaluated. does value of `i` increment in the middle of expression?
 
11:26 AM
@jalf Oh, my previous experience doesn't play nicely into this specific job :(
 
i++ is postprefix so it gets added after its been inserted. --i is the other way around
 
It could be possible to write a bidirectional iterator but since incrementing and decrementing would largely be no-op that's just an obscure interface to pop and push.
Seems far-fetched though.
 
@Kaj added=incremented
 
@lovesh If you see code like that, run. It's undefined behaviour.
2
 
@Martinho Seems pretty geeky to me :D
 
11:28 AM
@RMartinhoFernandes just use your imagination ;)
 
@RMartinhoFernandes r u sure its undefined behavior? coz i checked this in 2 compilers gcc and turbo C and the result was same
 
in Tavern on the Meta on Meta Stack Overflow Chat, 3 mins ago, by Moshe
is lost, and doesn't know what page his C++ homework is on
 
@lovesh try with different compiler options
 
if nothing else, then your previous job made you realize how much you'd rather be working with whatever the job you're applying for is about
 
@lovesh That proves nothing.
 
11:29 AM
in Tavern on the Meta on Meta Stack Overflow Chat, 3 mins ago, by Moshe
There is a textbook, workbook and a handout. The homework is to: write, compile, handcheck and trace "listing 1d", which I can't find, but I'm sure I will eventually.
 
@lovesh the problem is sequence points
 
13
Q: Could anyone explain these undefined behaviors (i = i++ + ++i , i = i++, etc...)

PiXint main(int argc, char ** argv) { int i = 0; i = i++ + ++i; printf("%d\n", i); // 3 i = 1; i = (i++); printf("%d\n", i); // 2 Should be 1, no ? volatile int u = 0; u = u++ + ++u; printf("%d\n", u); // 1 u = 1; u = (u++); printf("%d\n", u); // 2 Should also...

 
I had a project with a really tight deadline where I used to code like this: if ((var>1?"test":"test2").equals("test")) etc.. you get the point
 
@jalf That I can work it :)
 
Hi everyone
hello...
 
11:39 AM
thanks for the help
 
cool name
 
> Given the total @#$%up that namespaces turned out to be in c++, why should/would they plan to include it? – Chris Becke Dec 9 '10 at 8:29
I remember this guy.
 
lol
> For string literals there is an array-to-pointer conversion during argument deduction if and only if the parameter is not a reference.
why is this so? is it because a ref cannot be converted (decayed) to a pointer?
 
Context? I'm assuming this is relative to C++03 as it doesn't disambiguate between lvalue ref or rvalue ref.
 
@LucDanton yes
 
11:44 AM
But the answer is probably because the result of a conversion won't bind to an lvalue reference and if it's an lvalue ref to char array it doesn't need the conversion in the first place.
 
C++03
 
i.e. you can't do int& i = 42.;
Notice that 42. is a double prvalue.
Similarly, you can't do char*& p = "Nope";
 
do something like const int& i = int(42)
 
hmmmmm
 
That second int is unnecessary.
 
11:46 AM
> In member function 'void annex::forward_task<Ret(Args ...)>::operator()(A&& ...) [with A = {int&}, Ret = int, Args = {int}]':
> error: no match for call to '(annex::forward_function<int(int)>) (int&)'
 
Or rather it doesn't change anything.
 
Oh wait nevermind.
 
how do you do strikethrough of text on here?
 
---foo---
 
This again?
 
11:47 AM
test
 
Every two weeks someone asks this.
 
So I get
> error: no match for call to '(annex::forward_function<int(int)>) (int&)'
 
Well, they could include it in the help.
 
Relevant type has operator() declared as such:
Ret
operator()(Args&& ...args) const;
 
11:48 AM
There's nothing in newbie hints either.
 
Also relevant:
template<typename Ret, typename ...Args>
class forward_function<Ret(Args...)>
 
Yes, I couldn't find it anywhere, not even in the official chat FAQ
 
Any idea to write a 'better' operator()?
 
Why isn't it working?
It should, shouldn't it?
 
11:52 AM
Well
 
I just fixed a bug by printing a debug message.
 
For forward_function<int(int)>
operator() has signature int(int&&)
So int& won't bind.
I could do operator()(Args... ) but since that may involve copying/moving I'm going for perfect forwarding instead.
Thinking about what kind of static_assert I'll put inside now.
static_assert( and_<std::is_convertible<A, Args>::value...>::value, ... ); I guess
 
static_assert(..., "AMAGAD ERROR!");
 
1min19 for a compile error.
Changing my type trait header is fun!
Oh wait I triggered my new assertion.
 
lol
damn, facing another C++ situation where I can't do what I want because of declarations and definitions
 
12:12 PM
> otherwise, the value is tid and its type Vi is TiD cv &.
Fuck std::bind.
Going to rename my forward_bind to perfect_bind one of these days.
 
isn't that what lambdas are for?
 
wut.
 
lambdas > bind
 
How do you put a move-only type into a lambda?
What a silly thing to say.
 
I'm not entirely sure, but I have done it
he says, thinking about it some more
 
12:15 PM
typedef std::unique_ptr<int> pointer;
With std::bind you must do e.g. auto f = [](pointer& p) { /* use p */ }; auto bound = std::bind(f, /* bind unique pointer here */);
This annoys me so much I have a forward_bind that works with auto f = [](pointer p) { /* use p */ };.
In other words the argument of the functor is initialized with the same value category as what's passed in the bind expression.
(But I lie because forward_bind isn't a bind at all. Can't deal with placeholders and nested bind expressions.)
 
I don't see what's wrong, cause I can compile it with ideone
 
then ideone is wrong
 
12:30 PM
It's possible that iomanip or functional or just the standard headers have dependencies on something in locale
 
ctype is irrelevant
 
so is the problem what my deleted answer says?
 
you can't compile a reference without initializing it
 
see that's what I thought, but the fact ideone compiles it, threw me off
 
@DeadMG Yes sorry
 
12:32 PM
I undeleted my answer
 
It's initialized in the constructor. I don't see any problem with that.
 
oh, tony never said anything about a constructor
 
seems VC++ also allows this type of construct, by intializing it in the ctor
 
oh yeah, I read the actual question now and that's perfectly fine
 
oh ok
 
12:35 PM
just like any other non-default-constructible thing
basically
 
what are traits?
 
Types that describe types.
 
traits have traits as well. it turtles all the way up.
 
@CatPlusPlus : they are important?
 
@MrAnubis they're useful
 
12:40 PM
found good article : accu.org/index.php/journals/442
not good article , no use of traits there
 
@MrAnubis they're commonly used to tailor your code to specific types. For example, there's a std::is_const<T> trait which can be used to find out if some type is const or not. Then you can take different code paths depending on the result
 
Uh, there's at least five alternative Android rooms.
 
And all closed down?
 
1:02 PM
btw people prefer this book David R. Musser and Atul Saini, "STL Tutorial and Reference Guide," to "c++ standard library by josuttis"
Minus Minus Cat == plus plus Cat - 2
 
1:27 PM
Has anyone used L4 before ?
 
L4 cache?
 
No, the microkernel API
 
@ManofOneWay only if you want to own a copy
 
Maybe it's possible to download somewhere
 
1:38 PM
If you want to learn it, buy a good book instead (though it might take a while for good books updated to C++11 to come up).
 
@ManofOneWay The FDIS is available on github
 
note that the legal status of the FDIS is pretty iffy, as it's no longer publicly available
 
it's also available by googling it
 
If you want to legally own a copy of the standard, you have to buy it. But it is perfectly possible to code C++ without owning a copy of the standard
 
1:42 PM
The FDIS itself has a note on the second page about that. IANAL, but it seems to forbid any kind of reproduction without express consent.
Which is weird, since it's on github.
 
maybe it's not legally on github
 
It was placed there by a member of the committee.
 
oh, I don't know then, IANAL
 
I'll save a backup of it.
 
The final draft is N3290.
I have no idea what changed.
 
The thing is all over the place though.
I don't understand why they made it public if they intended to sell it.
I bet someone messed up.
 
Me neither. Also the price is surprising. 300 EUR is ridiculous for a company which needs such detailed knowledge, and is way too much for an individual.
 
Oh noes, not again.
 
What ?
 
Start reading here if you want.
 
1:55 PM
man
that 59 seconds book is pretty funny
 
What book?
A self-help book?
 
yeah
it's talking about this psychological thing where if you ask people not to think about X, then they think about X
and one of the examples is "Asking the public not to elect fools into office produces George Bush as President".
 
So, Michele Bachmann is going to win 2012?
 
lol
 
May I ask why you're reading a self-help book?
 
2:01 PM
because I keep finding recommendations for one?
 
@DeadMG Please don't think about making me a sandwich.
 
like if you go to the latest coding horror entry, it contains a recommendation
now I'm thinking about buying it because it's plain funny to read
 
Hmmm, haven't read Coding Horror in a while.
 
@kbok Except I can't think about making you a sandwich because, for numerous reasons, it's impossible for me to visualize such a thing
 
Oh, there's been nothing new to read on Coding Horror for a while.
 
2:03 PM
like the fact that I have no idea what you look like
 
Like a white ball with red lips?
 
sounds like anyone
 
@DeadMG You could send it via UPS. I'm not sure it would still be good though.
 
Have you guys seen Michele Bachmann's irrefutable arguments against measures to reduce CO2 emissions?
It's hilarious.
 
no
 
btw people prefer this book David R. Musser and Atul Saini, "STL Tutorial and Reference Guide," to "c++ standard library by josuttis"
true?
 
@AlfPSteinbach They're talking about Ariane 5 now on the Real Time Lecture.. =)
 

« first day (324 days earlier)      last day (4607 days later) »