« first day (782 days earlier)      last day (4159 days later) » 

9:04 AM
So if I want a queue in MSVC should I use std::queue or deque?
I have a feeling both suck
 
Well deque is probably better if you want to push front
 
I just want push/pop in FIFO
 
then use a queue?
I don't think they have any other differences other than the deque being double ended
 
I was under the impression that their deque was just vector<T*> and their queue was just list<T>
 
I don't think so.
 
9:16 AM
by default, std::queue is an adaptor around a std::deque
And a std::deque is not a vector of pointers
it's more like a vector of vectors
and of course, there's always the principle of "assume language designers aren't completely braindead"
Isn't it just possible, if we stretch our imagination, that they might have designed std::queue to actually be an efficient queue implementation?
In other words, that might just be the class you should use if you want a queue
 
@jalf Oh, ok. Thanks
Is a vector of vectors bad then? I always were told to avoid deque in MSVC.
 
std::queue actually takes a container as a template parameter, so you can tailor it to wrap another type of container if you prefer
but it's deisgned to be a good default
@Pubby bad at what? It depends on your needs
 
@jalf Well, is it bad for queues?
 
For insertions at the front, it avoids the vector behavior of having to copy the entire contents. And unlike a list, it provides random access (although that is somewhat slower than it would be for vectors)
would they use it for std::queue if it was? ;)
it has constant-time push/pop at the beginning and end
which makes it pretty good for a queue
 
According to cppreference, deques have amortized constant time for random access.
 
9:22 AM
and unlike a list, it doesn't require a dynamically allocated node for each element
 
Though it doesn't say anything for queues.
 
3
A: profiling: deque is 23% of my runtime

James McNellisI'd recommend avoiding std::deque if you are going to target Visual C++. If you open up the <deque> header shipped with Visual C++ 2010, you'll find the following macro that it uses to compute the number of elements to store in each "block" #define _DEQUESIZ (sizeof (value_type) <=...

^That's what I was reading, probably should have posted the link earlier
 
I've... never run the profiler in Visual Studio :|
Hell.. I didn't even know it existed
 
I need to get some sleep, I'm turning into a zombie fast. Bye.
 
Night. I should too.
 
9:36 AM
mawning
 
@Pubby well, give it a try. It might work well enough. Otherwise use a std::queue with another backing container :)
if performance matters, then measure, and make the right choice based on your measurements
 
@acidzombie24: Even with full optimizations enabled, it's still not too difficult to profile the program; you get less in-depth details due to inlining, but the profiler can still tell you the general areas that are performance hot spots. Profiling debug code is futile because code that performs poorly in a debug build may perform very well in an optimized build, and vice-versa. — James McNellis Apr 9 '11 at 20:33
^ that's amazing. Someone was profiling debug builds...
@sbi "fallen for it"? I laughed, if that's what you mean.
 
How's the polar bear today?
 
Busy
 
9:55 AM
oh that
 
10:19 AM
 
@Abyx Wut
odd that this has a lower score than amount of favorites/stars... — Robert S Ciaccio Aug 26 '11 at 2:57
odd indeed
 
Pinging @sehe & @R.Martinho – isn’t this a question for one of you?
2
Q: How to use boost::spirit to parse UNICODE?

StereoMatching#include <algorithm> #include <iostream> #include <string> #include <vector> #define BOOST_SPIRIT_UNICODE // We'll use unicode (UTF8) all throughout #include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/qi_parse.hpp> #include <boost/spirit/...

 
10:43 AM
@KonradRudolph Not again... Okay, +1ed since he already read the existing post(s?) on the subject.
@KonradRudolph More of a robot thing perhaps. The OP seems confused, since UTF8 seems to contradict the use of wstring for me.
I'm confused. You are ... using UTF8? Why the wstring then? (UTF8 is an encoding single/double/triple byte-sequences, right). I don't feel qualified to explain better, but this is a mismatch in my perception — sehe 10 secs ago
 
11:00 AM
@sehe True, hadn’t even noticed that
 
11:22 AM
woah it's quiet in here today...
ohai puppy!
seems there's only Java roles here
so unless you want to do Java, I'm afraid I've got nothing.
 
I'm converting Java 2.0 Embedded over to C++. Does that count for anything?
 
wut?
how's that related to anything I said?
 
Somewhere in something about java roles and my brain being fried.
 
lol
can't wait for the weekend
 
11:31 AM
@KonradRudolph Check my profile description on chat.
 
well, liar :p
 
@sbi I am so screwed with you guys around :S
 
@R.MartinhoFernandes how was the careers party?
 
@ThePhD And to prove the point that you are too stupid, you just give up and do the stupid thing. Good job.
@bamboon ´Twas nice. Talked to some cool people and shit.
@KonradRudolph Seriously, I started researching that thing since June. I can appear to know lots, but that's only because I have a broad thin surface of knowledge, while most people have none.
 
@R.MartinhoFernandes cool, which knowable guys were there? did they have some SO goodies on sale?
 
11:44 AM
Nothing on sale, I think. Everyone got a small swag package for free.
A T-shirt with a big "/de" on front. The good thing is that it fits only one of me.
@bamboon I only recognised balpha, because he uses a real pic on his avatar. Everyone had a name tag, but I did not recognise anyone.
 
@R.MartinhoFernandes There was shit too?
 
There is a slight possibility that my name tag might show up in a future blog about the party.
Someone from SO took a picture of it, for some nefarious purpose, I can only assume.
 
@R.MartinhoFernandes Did the name badges feature the gravatars?
 
No. It was just a sticker where you wrote your name on on arrival.
 
@R.MartinhoFernandes So, presumably you attracted attention by writing "The Robot"?
 
11:49 AM
Nah. It was an entirely different matter.
 
? do share :)
Free hand stars?
 
You sang a Portuguese Fado?
 
@bamboon I doubt that. There were still people there when I left.
 
@R.MartinhoFernandes ^^
 
@sehe It's nothing original really. Someone thought it was funny.
It read "Martinho \n I'm shy \n Talk to me"
 
12:07 PM
@sehe Remember the "trap" technique you taught to a background task when the parent task exits? Apparently it doesn't work if the script is invoked from Ruby's popen function. The process stays alive until the timeout has exceeded. Weird...
 
@R.MartinhoFernandes I'm sure Ape will teach how not to be shy.
 
user1182183
12:23 PM
Hmm maybe we have a coordinate geek here?
 
user1182183
1
Q: Calculating 2D positions from a curve?

Gam ErixI am with quite a dylema here, as I need this for a game (so I am going to transform the given answers into programming code) to make a polygon around a curved line. from each line segment I have the X and Y positions, not I need to calculate all the X,Y positions around the curve like this: T...

 
I already answered an identical question here on SO, I think it was
 
user1182183
The one on SO I asked here was a while ago and it eventually showed the same problems. (however it's not "a duplicate")
 
@GamErix That looks like it started as a very poor question ("Do this for me", without a clear definition of "this").
 
user1182183
@R.MartinhoFernandes started, I kept it updating and improving :$
 
user1182183
12:29 PM
well you can always check the revisions
 
user1182183
there's nothing I can hide lol ;D
 
Anyway, your program seems buggy.
 
user1182183
@R.MartinhoFernandes it's just a fast written test program to visualize results
 
user1182183
@R.MartinhoFernandes but what bugs do you see?
 
Yes, but I think the results are wrong because you coded it buggy, not because the answers are buggy.
But VB.
 
user1182183
12:31 PM
should I switch to C#?
 
It's very verbose, so reading source code takes ages.
 
user1182183
just C or C++ is not really an option as I don't know how to make form programs
 
user1182183
the bitmap class you don't need to read xD
 
user1182183
it's from an codeproject article and reviewed by many people
 
user1182183
so I can safely assume it's right
 
12:32 PM
Then what lines have the meaty stuff?
 
user1182183
0 to ~100
 
user1182183
1-143 to be exact
 
user1182183
I'll just clean it up etc to make it alot easier for you guys :$
 
user1182183
(at least I hope it will)
 
1
Q: Are there any unintuitive side-effects of member subobjects inheriting storage duration?

Lightness Races in OrbitI didn't know this before, but it turns out that: [C++11: 3.7.5]: The storage duration of member subobjects, base class subobjects and array elements is that of their complete object (1.8). That means that x->a in the example below has dynamic storage duration. I'm wondering whether the...

 
12:36 PM
Anyway, it's clear that in your outputs, in the parts where the lines cross, the points selected are not in the bisector.
I drew the bisector in orange.
 
0
A: Calculating XY positions from path reverses when path turns

DeadMGFirst, gain the position of the purple points for the first and last segments (this is pretty trivial). Then, for each of the blue lines, create two green lines which are parallel to it but appropriately spaced away from it. For the last and first blue line, you will have to explicitly terminate...

 
@Gam I checked the math in the answer by robjohn, and it seems correct.
Anyway, Y U NO DEBUG.
 
user1182183
@R.MartinhoFernandes i'm cleaning up the code, just a few mins
 
user1182183
(also commenting it)
 
Also, I seem to have broken my code. This thing should not take five minutes to load. WTF have I done.
 
12:48 PM
do streams throw when they fail?
 
Not by default.
 
depends
 
I'm opening a std::ifstream("somefile.txt");, but what if the file doesn't exist?
how do I deal with that?
try {} catch(someexception) {} ??
 
@TonyTheLion Obviously suicide.
 
if (!stream)
 
12:50 PM
But I don't want suicide...
 
@TonyTheLion Then eat a Snickers?
 
aw, shit
the dog is resident on my arms again
 
Oooh. Turns out InDesign does not like it if I ask it to load two different versions of my plugin. Ooops.
Though an error would be better than an infinite loop on the loading screen.
 
12:54 PM
@StackedCrooked Wut. Prints zero here.
 
bool_alpha isn't enabled by default iirc
 
Zero is false.
 
zero is false, nubbery
 
(Also, can haz that bookmarklet you posted yesterday?)
 
@R.MartinhoFernandes wut?
now you're confusing me, damnit
 
@R.MartinhoFernandes Oh you!
 
@TonyTheLion Don't worry, trust the puppy. I cheated and created a file named I_DO_NOT_EXIST previously :P
 
I want to allow file system access, but each session should probably start with a clean environment :)
 
user1182183
@R.MartinhoFernandes gpb.googlecode.com/files/DRAWER3.zip take a look? maybe you can spot what I do wrong with answer #2
 
user1182183
it's nicely , eye-friendly commented
 
I've been spending all day on a linker error: undefined reference to typeinfo for myclass
Still haven't found it.
 
1:04 PM
@GamErix Sorry, I'm busy right now.
 
user1182183
okay :4
 
What's that thing to convert wstrings to stringss?
 
oh it's vb
meh
 
@R.MartinhoFernandes monad?
 
@R.MartinhoFernandes std::string(mywstring.begin(), mywstring.end());
 
1:06 PM
Wut.
I am certain that is not it.
 
^ Reminds me of Michael Jackson.
 
hmm
I think the dog knows I just talked about taking her out
 
They are very quick to understand that :P
 
@StackedCrooked does it run as sh or as bash? Are you sure it continues running or maybe it is just sitting around defunct (to do with SIGCHILD/wait3?).
@GamErix "End Class". How appropriate. On many levels.
 
user1182183
1:19 PM
@sehe is that a compliment? ; o
 
:)
 
user1182183
yay finally I did something good XD
 
:(
 
user1182183
@sehe hm? well that code will be converted to C++
 
user1182183
after I got the polygon calculations right
 
user1182183
1:21 PM
*I already know it'll be a mess :p
 
user1182183
but it will work xD
 
@sehe I'm running it as popen("./sandbox.sh"), the script has a shebang for /bin/bash. I worked around it now by implementing a Ruby's timeout around the popen call (and removing the timeout logic from the bash script).
You might notice that coliru is much faster now. Previously it always took 10 seconds per compilation because it waited until timeout.
 
> Another good thumb-rule: the number of times you should re-read an email before sending is equal to the number of people you are sending it to. (And yes, this rule scales.)
^ good advice
 
cpx
I forgot. Why are qualifiers are ignored in C and C++ when used on function declaration like this:
 
@GamErix Are you sure that will be an improvement?
 
cpx
1:24 PM
int f(const int i);
int f(int i) {}
 
@StackedCrooked is coliru the new name of your site?
 
@sehe Also don't fill in the To field before you are ready to send.
 
@bamboon The software project
 
user1182183
@sehe I cannot be but there is NO WAY to make a .dll in VB for the PAWN engine
 
coliru = compile/link/run
 
1:24 PM
@StackedCrooked That's habit. Doesn't guarantee quality of content, though
 
user1182183
Dim x As Point
x = New DPoint(10.0, -50.6)
, I feel great I solved this myself LOL (google didn't help :( )
:
Public Overloads Shared Widening Operator CType(ByVal d As DPoint) As Point
Return d.ToInt()
End Operator
 
user1182183
srsly I just type whatever and it cam out like this
 
@sehe Not, but it makes me less nervous about accidentally pressing the send button :)
 
user1182183
and it suprisingly works ; o
 
That's perfect code
@cpx Oh you knew. See Stack Overflow it's been answered
 
1:26 PM
@StackedCrooked is that a common term?
 
No, not that I know.
 
cpx
@sehe Oh, yes I remember it was asked by @FredOverflow.
I'm searching his questions.
I don't want to look in the Standard.
 
user1182183
I suppose my operators are also correct (mainly the * and /) ?
Public Shared Operator /(ByVal a As DPoint, ByVal b As Double) As DPoint
Return New DPoint(a.X / b, a.Y / b)
End Operator
Public Shared Operator *(ByVal a As DPoint, ByVal b As Double) As DPoint
Return New DPoint(a.X * b, a.Y * b)
End Operator
for this:
p k ±5.0r(p(k+1) − p(k) )
 
8
A: Functions with const arguments and Overloading

Chubsdad§13.1 where the Standard discusses about declarations that cannot be overloaded states - Parameter declarations that differ only in the presence or absence of const and/or volatile are equivalent. That is, the const and volatile type-specifiers for each parameter type are ignored [....

@GamErix Go read lifehacker.com/5964225/…. NOW
 
user1182183
ir aren't coordinates calculated like that?XD
 
1:30 PM
@cpx n3337 13.1
 
cpx
@sehe Thanks!
@sehe I don't have C11 and C++11. Is it from C99?
 
@GamErix Y U NO DEBUG.
"I suppose"
 
user1182183
@R.MartinhoFernandes it does work, but are that the math rules?
 
user1182183
(a,b)/x = (a/x,b/x)
 
@cpx It's basically unmodified
 
1:32 PM
You said that the whole thing does not work. You have no zeroed in the line that produces wrong results.
That can easily be done by stepping through with a debugger.
 
@GamErix Math has no rules. Just axiomas
 
user1182183
@R.MartinhoFernandes I done that with answer one but at those points why it generates wrong results I don't know
 
(inb4 "are those the gravity rules?")
 
cpx
@sehe Okay. Thank you.
 
@GamErix Which points
Seriously, do you expect people to run your code through the debugger themselves?
Hint: people very very rarely do that.
 
user1182183
 
That's not stepping through the debugger.
 
user1182183
(SW) direction
 
user1182183
of the XY system
 
Which points (as in "parts") in the code?
FFS.
Run the debugger, set breakpoints, watch the variables, and see which are wrong.
 
user1182183
there is a loop which calculates then, let's count, .. Points(6th) and points (7th) so 5 and 6
 
1:36 PM
Yes, it may sound tiresome. Now think about it a bit, and notice that that tiresome work is exactly what you are asking people to do.
 
@R.MartinhoFernandes typos
 
And FWIW, this is coming from the guy that said this:
yesterday, by R. Martinho Fernandes
I am not much of a debugger person.
 
who is?
 
you and me
we're being
 
no homo
 
1:46 PM
glad you clarified
 
user1182183
repeat inf [I am a stupid motherfucker who forgets a sqrt]
 
user1182183
break repeat? I see the repeat has blocked the main thread / chat ; o
 
2:07 PM
ARsghjtdkhgfh , Project Property Pages Y U NO USABLE.
 
@R.MartinhoFernandes what are you doing?
 
Adding ICU to the list of stuff to link.
 
is that a problem?
 
Yes, it is. The Project Property Pages are not resizable, and the Additional Dependencies textbox is not multiline.
 
oh right
 
2:10 PM
So, I just copy that to a text editor and fix it there to copy back.
Sigh.
This shit has been like this since fucking ever.
(Well, at least VC6)
 
It is multiline if you click the dropdown thingy and select edit
you get a dialog up with a multiline textbox
 
Oh. That is actually not bad.
Thanks.
 
np :)
 
@jalf And surprise! It's a resizable dialog...
 
why won't svn let me ignore changes that I don't want to check in at this time, and then carry on with the check in to check in the things I want to check in.
damnit
 
2:15 PM
@R.MartinhoFernandes to annoy you. I steer miles clear of that. Frankly I'd prefer CMake to VS solutions with their bloddy damned property pages
 
@TonyTheLion You can select what to check in, IIRC.
 
Prop sheets are annoying
@R.MartinhoFernandes hmmm
 
@R.MartinhoFernandes It only fixes half the pain. It's still a pain to go through a gazillion nodes of some config dialog tree, after selecting just the right projects and build configs. If they have 'incongruent' settings, well, you're screwed. If you have a slip of the mouse, or the selection somehow got lost, go back to start (don't receive $20,000) etc.
 
@TonyTheLion not as annoying as not having prop sheets
 
@sehe I have no idea what you are talking about.
 
2:18 PM
@jalf assuming a simple (SIMPLE) replacement, or, actually un-replacement it would actually be far less annoying
@R.MartinhoFernandes property sheets in VS
 
Yes, I have no idea what you are talking about.
That's not how it behaves at all.
 
@R.MartinhoFernandes It did in VS6/VS2003. Never noticed it changed in VS2005. Haven't used later professionally (C++)
 
they changed a lot in VS2008 and 2010
not sure about 2012
 
Well, it's still not resizable, which is by far the worst of all the issues it ever had.
 
nonresizable sucks donkey cock
 
2:23 PM
property sheets are basically all the settings you can set via property pages, but pulled out into project-independent files which individual projects can include. So you can define a property sheet with all your settings, and then simply tell all your projects to include that property sheet
instead of duplicating the settings for every project
can also include multiple property sheets or include them recursively and whatever else you like. Pretty much a must if you're dealing with more than 2-3 projects (unless you're using cmake or something like it which entirely bypasses the VS project structure anyway)
 
@jalf mmm. I never noticed such a feature. I will try it out next time on VS (which could be sooner since I'm actually using VS2012 at home for a little while)
 
But it's not resizable, man.
Not resizable, motherfucker. Do you speak it?
 
my head hurts
 
@sehe yeah, you pretty much have to know it's there ;)
otherwise you'll never find it
 
> The biggest mistake Microsoft made was to stop developing VB6. Everything after that has been a failure.
lolzies
 
user784668
2:39 PM
In what warped world is that a "mistake"?
 
@R.MartinhoFernandes oh gawd. What planet does the guy that said that live on?
 
user784668
People don't know how to google anymore.
 
user784668
-4
Q: Algorithm or library function for Calculating nCr ("from n choose r")

LAPIs there any existing library in C++ for finding nCr ("from n choose r")? If not, can you suggest an algorithm for finding it (if any method exists other than dividing the factorials) quickly?

 
@Fanael I tried searching for google and I couldn't find anything
 
google google
google ception
 
2:42 PM
That's actually a good idea for a bad luck brian mime: Googles "google" ... no matches found
 
lulz
oh look, it's a Cat!
 
googling recursion is way better
 
I hope you step on Lego
 
user784668
 
WTF. How is U+0031 DIGIT ONE a private use character. I feel as if ICU was trolling me.
 
2:44 PM
@Fanael Hah
 
user784668
@R.MartinhoFernandes You can't use it in public because it's offensive to people who can't count.
 
And now the great Visual Studio debugger cannot watch this because "CXX0052: Error: member function not present". Awesome.
 
I think I'm gonna add XML to my pet peeves list
 
FFFS. (For Fucking Fuck's Sake)
Are inline functions not usable in the VS debugger?
(Yes, this is a Debug build)
 
user784668
2:49 PM
VS debugger sucks.
 
user784668
It's a shame others aren't any better.
 
Bollocks. GDB mostly works.
 
user784668
@R.MartinhoFernandes Except when it doesn't.
 
@Fanael VS's mostly does not work.
 
2:50 PM
You suck.
 
user784668
@R.MartinhoFernandes So what?
 
I have lost track of the number of times I needed to work around some stupid limitation.
1 min ago, by Fanael
It's a shame others aren't any better.
 
In my work project packets are "popped" from Ethernet up to IPv4, TCP and HTTP (different routes depending on the packet content). I thought it would be nice if the "pop" function would take a trail of lower-layer protocols (using variadic templates). However, when (potentially infinite) VLAN stacking is inserted in the chain then the compiler enters an infinite loop.
 
cpx
@sehe: It was this one:
11
Q: Can I pass constant pointers disguised as arrays?

FredOverflowvoid foo(const char *s); is equivalent to: void foo(const char s[]); Are there similar equivalents to the following two? void foo(char * const s); void foo(const char * const s);

 
in my experience, the VS debugger has always worked much more reliably than gdb
not that it matters. Please don't drag me into a big nasty tool-bashing argument :)
 
user784668
2:52 PM
@jalf Your experience is irrelevant. The robot says it sucks, it sucks.
 
@jalf Do you know if you can watch inline functions, or if I am doing something wrong?
 
@Fanael his experience is quite relevant, cause he has a lot of knowledge that is very useful and it's nice he's willing to share it on here.
 
watch? You mean like break if it changes?
or just put a breakpoint on?
 
user784668
@TonyTheLion You suck at sarcasm.
 
cpx
Going to rest.
 
2:53 PM
@jalf No, use it in an expression on the watch window.
 
@Fanael I do. I thought that was known around here. :(
 
I get CXX0017: Error: symbol "GetValue" not found.
 
ok, I'm probably missing something here, but why would you want to watch a function?
 
(This is an inline function I created to work around the fact it said a member function was not present)
@jalf To see what it evaluates to?
 
user784668
@R.MartinhoFernandes Five.
 
2:55 PM
wouldn't that be a tracepoint in VS? Print out a message each time it's called?
 
user784668
@R.MartinhoFernandes See? You don't need no debugger.
 
@Fanael "42"
 
@jalf I am stopped at a breakpoint.
I want to see the value of "foo.GetValue()".
 
Now we’ll see what an implementation of a tuple with such an optimal layout actually looks like. http://rmartinho.github.com/cxx11/2012/12/02/optimal-tuple-ii #cpp #cplusplus
^ Woot for the robot again
 
ah ok, yeah, it really really sucks at calling functions interactively. It might be possible to do somehow, but... I've never done it because it seemed so needlessly painful
 
2:56 PM
@jalf Yeah, I am coming to that conclusion now.
 
@R.MartinhoFernandes gdb has no issues with that sort of request :)
 
@sehe I know. Sigh.
Does this mean I need to twist my code into storing this into a variable first?
This is on a member initializer list, which means I am fucking screwed.
 
user784668
Ouch.
 
@R.MartinhoFernandes Lambda.
 
user784668
@R.MartinhoFernandes Blame Herb.
 
2:58 PM
@DeadMG Does the debugger work inside lambdas?
(That is a joke, now)
 
: member([&] -> T { auto x = foo.GetValue(); return std::move(x); }())
uglytastic, but should work
 
user784668
Shit, that's ugly. Almost as if it were C++.
 
user784668
Wait.
 
@R.MartinhoFernandes couldn't you just write a unit test which calls the function and tests that it works? ;)
 

« first day (782 days earlier)      last day (4159 days later) »