« first day (762 days earlier)      last day (4169 days later) » 

12:00 AM
@angryInsomniac No, you don't.
use a custom destructor in your smart pointers, don't delete.
 
@Xeo yeah, I guess that works, though that's virtually the same as a deep copy
 
Your pool should really just allocate a giant char* array of like 300,000 right up front. Then you should use a custom Constructor and Destructor (or a custom Pool.New) to request memory, and a (Pool.Delete) to get rid of memory.
 
Xeo
@MooingDuck How so? (Un)registering the location is a pointer copy / destruction, and the state of the object itself is moved.
 
@angryInsomniac how do the vector3s get the memory?
 
@DeadMG ohh , wouldn't that mean that the person using the vector3Ds will have to use that custom destructor ? I was trying to put my interface above new/delete , so that the user is not aware !
 
12:01 AM
@ThePhD not relevant
 
Oh well I'm lost then. Let me slide out of this conversation all quicklike.
 
@angryInsomniac Impossibru- you will have to abstract the destructor. std::shared_ptr type erases the destructor already, and you can do the same with std::unique_ptr<T, std::function<void(T*)>>.
 
@Xeo yeah, I was assuming... stupid things again. Yeah, so that also works
 
@MooingDuck I fetch my memory from a preallocated array (which is my mem pool) and then return an address to it whenever a new vector3d is created
 
@MooingDuck Yes, that's what I was talking about (i.e., in your example, a is essentially a container/owner of c).
 
12:03 AM
@angryInsomniac if you allocated the memory and gave it to the vector3d, then when the vector3d is done, it should not free the memory, and you should.
 
honestly, asking your user to delete your objects is just the bad anyway.
 
@MooingDuck Yup, here is what I was trying to do , overload the delete operator for the vector3d so that it calls my custom free method
 
@angryInsomniac you should really look at the allocator template parameters of the standard containers
 
@angryInsomniac Nah, you need a custom deleter function object.
 
that way the interface was above new / delete and the user can use the vector3d (or any other pool managed class) without having to know any lower level details ) but apparently that cannot be done)
 
12:06 AM
tbh
your user should not be dealing with new/delete for your objects anyway
that's just the riskies
 
@angryInsomniac it can, but to hide it completely is slow.
@angryInsomniac the best idea is to just make it like the standard containers
@angryInsomniac I really wish I could understand what you meant :/
 
user1804599
How deep in the ear is the eardrum, approximately?
 
Ell
Half a pinky
 
user1804599
Thanks.
 
12:12 AM
by a quick Google search
 
user1804599
So you can touch it with your finger?
 
prolly
don't think it's adviced
 
user1804599
Let's not do that.
 
but I know nothing about Biology
 
Ell
You can perferate it With your finger
 
12:13 AM
I failed it badly at school
 
user1804599
@Ell meh.
 
witness my shit sex life :P
 
user1804599
Perforating your eardrum is the worst idea I have ever heard.
 
user1804599
@TonyTheLion I am not into poop sex, sorry.
 
it is bad, and you should feel bad
 
12:13 AM
@MooingDuck well nvm :) I'll figure it out !
 
@Aardvark lol
 
Ell
Not as bad As snapping your banjo string
Or inserting A wood splinter into your japeye
 
I'm in the epiphany line...
 
user1804599
Or poking your eyes out with a ladle.
 
where is the epiphany? I want my epiphany!!! Damnit!
 
Ell
12:14 AM
Or placing a cocktail stick underneath your toenail then kicking a concrete wall
 
@angryInsomniac usually the "container" has an allocator member, which is uses to allocate and deallocate memory for its "containees" (And usually it's std::allocator)
 
user1804599
@Ell are you James Wan?
 
Ell
i don't know who that is :L
 
user1804599
The director of Saw, Saw II, Saw III, Saw IV, Saw V, Saw VI and Saw 3D.
 
@MooingDuck My implementation is similar
but I guess its wayyy too much to explain, I'll just figure it out :P
 
user1804599
12:18 AM
Glasses make you C#.
 
Xeo
Hey @LucDanton, at one point you mentioned that the expression in a return statement is already an xvalue... how so?
 
user1804599
Because it is going to expire.
 
Xeo
An xvalue is only produced when you involve rvalue references.
 
Guys is it possible that I am a figment of my own imagination?
 
user1804599
@Xeo not sure if relevant, but return moves when possible.
 
user1804599
12:22 AM
But yeah, I'll stop since I don't know shit about rvalue references.
 
@Crowz no
 
@MooingDuck EXPLAIN, MERLIN AND YOUR BOOK OF SPELLS AND POTIONSSS
 
@Xeo I'm fairly sure the specific message you linked is an answer to "I mean, xvalues are moved anyway, aren't they?".
 
Xeo
@Aardvark I know that. :)
@LucDanton Ooh, good point.
 
@Crowz also: get help
 
12:25 AM
@MooingDuck why?
 
user1804599
Hey, guys! Guys. Listen. I found this new agile tool! It's called "writing shit down in a list, then fucking doing them one by one".
 
12:39 AM
@Xeo TG is coming so I'll put it off until the Monday after. It's a good thing we didn't do it this week. :)
 
Xeo
TG?
 
I'm amused when I see interesting quotes on teh star board, but when I try to star them, it says "You cannot star your own messages". I wish I had a longer memory :(
8
 
Thanksgiving
 
Xeo
Ah
What was the question again, anyways? It was that lambda syntax stuff, right?
 
I saw that three people starred that and immediately though "that is funny" and tried to star it :(
stupid brain
 
12:41 AM
@Xeo "How is "int main(){(([](){})());}" valid C++?"
 
Xeo
So it was.
 
@Mysticial ....what the
 
Xeo
@MooingDuck lambda wrapped in unnecessary parens
 
Feel free to prepare a long answer for it. But if it's too long make sure you don't dump the whole thing at once.
 
user1804599
Thanksgiving, that was the day with the turkeys right?
 
Xeo
12:42 AM
@Mysticial I don't think it'll take a long answer
 
@MooingDuck It's my way of "thanking" Xeo for getting me two big answers.
 
user1804599
@Mysticial that's the kind of C++ where C stands for Clojure.
 
Xeo
@Mysticial I think I need ~10 lines at most
 
@Xeo I parsed it, it was just wierd
 
@Xeo Try to make it interesting.
 
12:45 AM
@Xeo also freehand circles
 
Like my opening sentences for the branch and denormal answers.
 
 
Xeo
@Mysticial "Welcome to Lisp++!"? :P
 
Nah... I didn't get it at first.
I'll be making a javascript comparison in the question. So you can allude off of that.
 
Xeo
@Mysticial Wait, what?
This is getting complicated.
 
12:50 AM
@Xeo Send me an email, and I'll send you the entire question.
 
Xeo
I think I'll just stick to my 10 line answer and do something on the spot in the 5min grace period.
I think that's for the best.
 
haha
 
omg a final jeopardy category i can relate to!
Math Men
 
user1804599
In JavaScript it is (function(){})(). In CoffeeScript it is (->)().
 
user1804599
Where can I find the reason this is a pointer? I know why, but I cannot find the webpage that told so anywhere.
 
12:55 AM
"In 1880, he wrote, "We draw two circles, and make them them include, or exclude, or intersect one another."
 
Xeo
@Aardvark this came before references, IIRC.
 
Easy clue, but I have no idea what Venn's first name is.
 
user1804599
@Xeo "I know why, ..." :P
 
John apparently, but they're accepting Venn.
 
user1804599
I thought it was in Bjarne's C++ FAQ, but that seems not to be the case.
 
Xeo
12:56 AM
@Aardvark SO :P
 
user1804599
 
The only time this is a reference is when you make a std::function<void (S &)> and set it to a member of S :)
 
Xeo
@chris That doesn't change what this is.
 
No, it's not.
 
user1804599
this is always a reference, but not a reference as in C++. :)
 
1:04 AM
@Xeo, I know, I know. It just takes the place of what would be a pointer.
 
@chris I'm pretty sure that's a GCC bug
 
What's GCC bug?
 
user1804599
Its license.
 
@CatPlusPlus wait, I was thinking of when GCC lets lambdas capture member variabless by reference. That's very different.
 
Why shouldn't it let capture data members by reference?
 
1:09 AM
@CatPlusPlus spec says it shouldn't capture member variables
 
user1804599
I haven't worked on my functional library today. I think I'll document it tomorrow.
 
What.
 
you guys dont know the secret
 
user1804599
Of course we don't, silly. That's why it's a secret.
 
@CatPlusPlus I checked the spec, apparently spec says that member variables can only be captured by reference, and I misremembered about GCC.
 
user1804599
1:12 AM
There was a hot hipster on the bus today.
 
That's slightly better but still "what".
Why can't they be captured by value.
 
@CatPlusPlus because this is always captured by value
 
So?
Maybe I want a fresh copy, not a closure.
So much for explicitness and usefulness of capture list.
 
aha, stackoverflow.com/questions/7895879/… lambdas can only capture things in the enclosing scope, and member variables are not in the enclosing scope, but this is.
you can make a reference in the function, and capture that. But yes, it's foolish.
 
Xeo
@MooingDuck They're planning to change that, btw.
 
1:16 AM
@Xeo oh good
 
oh god.. Higurashi Kai is horrible...
 
Xeo
@Mysticial How so?
 
Just like C++.
 
@Xeo Have you seen it?
 
Xeo
10
A: Is there any performance gain if I use [this] instead of [=] in lambda functions?

XeoThere is no performance gain, since as you said, only the variables you actually use inside the lambda are copied for [=].† It's mostly lazyness on the coder's part and keeping the lambda head concise. If you use new variables, you'll have to expand the capture clause to include those variables, ...

I mention it there.
@Mysticial Nope, only played the first chapter of the Higurashi novel. :)
 
1:17 AM
@CatPlusPlus auto&& foo = this->foo; >.>
 
@Xeo Higurashi Kai is basically an ecchi harem with the main characters of Higurashi.
 
Xeo
Ew.
 
Funny and entertaining, but horrible.
Hehe... episode 3 is like a big "fuck you" to all the blood fanboys.
 
@Xeo for large objects, that copies the member to the stack and then again to the lambda. Can the stack part be a reference to avoid that?
 
1:23 AM
Woah, a proposal to the actual committee?
 
Xeo
@Mysticial Via std-proposals.
@MooingDuck I think so, yes.
Yeah, that should work.
 
- the criteria for copy-elision are met or would be met save for the fact that the source object is a function parameter, and the object to be copied is designated by an lvalue, or
technically ambiguous, English doesn't have precedence rules.
 
Xeo
@MooingDuck Comma evaluates left-to-right. :D
 
@Xeo oh, right. comma clarifies
 
Xeo
Also, it's the text that is currently in the standard.
I just added that second bullet.
Well, and made it a bullet list in the first place.
 
1:29 AM
@Xeo I deduced that
 
Xeo
So yeah, thanks for the reference idea, gonna add that to my answer.
 
@Xeo wait really? I assumed it wouldn't work right since it wasn't in your answer O.o
 
Xeo
@MooingDuck Hey, I'm not an omnipotent being!
There we go, edit done with proper attribution.
 
user1357851
I have never thought how much effort google put into improve the accuracy of the locations until I used apples and windows phone's map
 
@Telkitty a single woman is looking to hook up with you right now! Now this is accuracy!
 
Me mateys, anyone know a way to get YouTube videos and inch through them frames at a time?
 
Xeo
@MooingDuck Holy shit, the chat is spammed with that.
Wait, it's only this room.
 
@CaptainGiraffe Yeah, it's always right near me! And she always look like a porn star. Strange.
 
@StackedCrooked something to do with ADL?
 
1:56 AM
Maybe.
 
Xeo
@StackedCrooked Add make_string& operator<<(std::ostream& (*manip)(std::ostream&)){ manip(ostr); return *this; }
 
failing to find ostream& std::operator<< (ostream& ( *pf )(ostream&));
 
Xeo
std::endl is templated on charT and traits
And since you don't provide a conversion context, the template argument can't be deduced.
 
Uhm.. ok :(
 
@Xeo good call
 
Xeo
Pop-quiz! What's the problem with std::cout << static_cast<std::stringstream&>(std::stringstream() << "Hello, world!\n").str(); ?
 
you should also handle these two:
ostream& std::operator<< (ios& ( *pf )(ios&));
ostream& std::operator<< (ios_base& ( *pf )(ios_base&));
 
@Xeo It's convoluted! :P
 
@Xeo static_cast shouldn't be used to cast to derived.
 
Xeo
@StackedCrooked :P
@MooingDuck Nope, that's totally fine if you know the derived type for sure.
 
2:03 AM
@Xeo sure? hm
 
Xeo
Sure.
 
wait, you can't std::stringstream() << can you?
 
Xeo
You can.
 
oh right, just can't give it a name
hmm
 
@MooingDuck Yes.
If the actual type is wrong it's UB instead of giving you nullptr like dynamic_cast.
 
Xeo
2:05 AM
Okay nvm, it was just a C++03 problem. :)
All free operator<< overloads only took an ostream& lhs argument, and a temporary can't bind to that.
 
@Xeo There is no guarantee that (std::stringstream() << "") will return an object of type`stringstream` ?
 
Xeo
@StackedCrooked It will never, in fact.
Except if you mean the dynamic type.
 
I mean the dynamic type.
 
Xeo
As I was saying, the free operator<< overloads couldn't handle a temporary on the lhs, so only the member overloads were viable.
 
@StackedCrooked it's guaranteed it won't
@Xeo ah
 
Xeo
2:07 AM
And there is no operator<<(char const*) member overload, only operator<<(void*)
With C++11, we got free rvalue overloads that just forward to their lvalue overloads.
 
Oh, I see. std::stringstream() couldn't be bound to a non-const reference, so that ruled out the free overloads.
 
Xeo
Aye
 
Goggles on Facebook shows a pretty anime girl.
And it seems like somebody's working on it right now.
 
Xeo
Just the top-level domain?
 
Xeo
2:12 AM
Ah, I had https for some reason.
 
You see it too?
 
Xeo
Is the figure drawn at the edge of the page or is it my small display that doesn't show it whole? :(
 
I see this:
 
Xeo
Oh well, zooming out works.
Hm, that hand needs a single line to make it look less weird
It has to cut off the thumb from the back of the hand.
 
It's holding a wine glass now.
And she's pouring out on the floor, or something.
 
Xeo
2:15 AM
Martini
 
@Xeo her left hand is a right hand O.o
 
Xeo
@MooingDuck That's what I meant.
With a single line, it looks less creepy. :)
I suck at writing with my mouse.
 
interestingly, that's not remotely what I see
 
Xeo
Haha
 
2:23 AM
Is he Rolal?
 
Xeo
Seems to be him.
Heh, it's the character's name.
Oh wait. That supah1337 might be the other one.
This is the one.
Aw, somebody's erasing it all.
 
Aw man... I'm finally starting to get a grip of this whole Scala/Lift beast. So hard when the documentation is inexistant.
 
Is there a precise way to make an outline of a photo?
So I made an edge detection on picture program and this is the result:
 
2:41 AM
Is that you?
 
Xeo
2 messages moved to bin
Don't you go and waste my screen space.
 
So... how would anyone know what is wrong?
 
What is wrong with what
 
Anyone.
Ok, Jinrui wa Suita Shimashita is quite a ...strange series.
 
@CatPlusPlus I want the edges to be SHARP
 
3:02 AM
@StackedCrooked The start of Eden of the East is as well. Speaking of which I should finish/rewatch that. Epic stuff it was.
 
Xeo
@Borgleader Higashi no Eden was good, but the movies kinda ruined it. They tried too hard.
 
@Xeo Haven't seen them yet.
 
3:42 AM
I just uploaded my project from VS 2010 to VS 2012 and now i get : 'not1' : is not a member of 'std'
what sorcery is this
 
@Dave Might not have included the right header? Newer versions tend to be pickier about that.
 
hmm
it seems the project is now unusable in vs2010
i bet i have to setup the project settings again
*rages
seems i have to recompile sfml for vs 2012
ah i fixed it
had to change the toolset to v100
 
4:08 AM
posted on November 15, 2012

If you can divide your data structures into a data part and a structure part, and you can write an audit program that is capable of rebuilding the structure from the data, you can use the auditor not only to make your programs more reliable, but to get them working more quickly than you might be able to do otherwise.

 
fischer price's my first database
 
if you setup a vector with a class like so:

`std::vector<CreateButton> button;`
how do i send values to button in a loop ? i tried button[i](value1,value2); but thats not allowed
i also tried CreateButton button[i](value1,value2);
that also didn't work
guess everyone is asleep :P
 
4:26 AM
What does 'send values to button' mean? I.e. what would you do if you had a button b to send a value to?
 
value 1 and value 2 gets assigned to the members in the class
 
button[i].foo = value1; button[i].bar = value2;
 
ah so button[1].membername = value1;
 
If a CreateButton is only ever made up of those two values you may be able to use assignment to a CreateButton with C++11: button[i] = { value1, value2 };.
That's an assignment of the style CreateButton b; b = { value1, value 2 };.
It's not what you want if you're just replacing some values while preserving the others. This is for all of them.
 
WE MUST ATONE FOR THE TONER!
 
4:31 AM
(Assignment in C++03 would look like button[i] = CreateButton(value1, value2); assuming a CreateButton is constructible from (value1, value2).)
 
ok but i already declared the datatype CreateButton in the vector? won't that be a redeclaration ?
hmm ok that didn't work =/
 
No you didn't.
 
std::vector<CreateButton> button; ?
isn't that the type declaration
 
That doesn't declare CreateButton.
 
no it sets the data type for button doesn't it ?
 
4:34 AM
That's not wrong.
 
try to make a vector of buttons, instead of vector of make buttons
 
ok cos im used to writing it like className varName(value);
 
button[i] = whatever; is not a definition (much less a declaration), it's an assignment.
It's the same difference as between int i = 0; and i = 0;.
 
@Cheersandhth.-Alf my goal was to try and make a vector of make buttons :P
what if i use push back
 
push_back always inserts a new item.
 
4:43 AM
hm ok so not that then
im trying to avoid taking a different approach xD
 
@Ell protip! if the keys stop working in Dwarf Fortress, try capslock
 
^ My error checking of Uuid class arguments Does Not Work(TM).
How would one in general go about such checking, at constexpr time?
 
5:01 AM
@Cheersandhth.-Alf What does that mean here? I'm eating a snack, can't run the code just now.
Also I think you can use the comma operator instead of BoolArg.
 
thanks, i'll try the comma operator!
maybe BoolArg gets optimized away...
 
lol, compilation is taking some time.
I'll just assume it doesn't terminate.
 
thanks, the comma expression worked
but the error message on invalid literal is pretty arbitrary & uninformative
[d:\dev\test]
> gnuc uuid_literal.cpp
uuid_literal.cpp: In function 'int main()':
uuid_literal.cpp:105:25:   in constexpr expansion of 'operator"" _uuid(((const char*)"x13709620-C279-11CE-A49E-444553540000"), 37u)'
uuid_literal.cpp:105:25:   in constexpr expansion of 'Uuid(((const char*)s), ((size_t)len))'
uuid_literal.cpp:68:33:   in constexpr expansion of 'Uuid::validSpec(((const char*)s), ((size_t)len))'
uuid_literal.cpp:64:80: error: expression '<throw-expression>' is not a constant-expression
 
i think i got it to work
button.push_back( CreateButton(Button.sprite,Button_On.sprite,theme[buttonx.str()],theme[buttony.str()]) );
 
so, now you have vector of buttons :-)
 
5:08 AM
yeh i was stuck on understanding how to assign the values to the private members
but i suck at explaining :P
 
@Cheersandhth.-Alf You're allowed to put static_assert in a constexpr function (which includes constructors). So you could keep the validation logic in an is_valid function and either static_assert( is_valid(s, len), "Oh noes! Helpful tip here" ); in the constructor or put that kind of static_assert in a validate function.
Or both I suppose. Constructors are kinda awkward here.
 
i tried static_assertearlier. it wouldn't have it.
maybe i did something else wrong
lemme try
 
I'd try to but compilation doesn't terminate :(
 
[d:\dev\test]
> gnuc uuid_literal.cpp
uuid_literal.cpp: In constructor 'constexpr Uuid::Uuid(const char*, size_t)':
uuid_literal.cpp:70:9: error: non-constant condition for static assertion
uuid_literal.cpp:70:9: error: 's' is not a constant expression
uuid_literal.cpp:70:9: error: 'len' is not a constant expression

[d:\dev\test]
> _
Same as I got earlier, as I recall.
 
Yeah that makes sense, I was totally wrong.
 
5:14 AM
The arguments are not really compile time constants.
well, the comma expression worked
i don't understand why the dummy base class trick didn't work, but
 
Apparently my copy of GCC completely fails to compile as long as validSpec is declared constexpr.
 
is there a built in function for string to double? like atof and atoi ?
oh found it strtod
 
If using C++11 consider using stod. Not a big deal though.
 
oh ok
thanks for the tip
 
5:33 AM
 
Should the result using perm = result_of::permutation_between<decltype(t), decltype(u)>; be such that slice<perm>(t) = u; or t = slice<perm>(u); holds?
Meh, no contest. Will be the later.
 
can any one see an issue here:

FILE * pFile;
pFile = fopen ("error.txt","w");

std::stringstream test;
test << "test" << i << "_y";

fprintf (pFile, "%s \n",test.str());

fclose (pFile);
 
the output i get is ð @ð
oh unless its expecting c_str()
 
It is.
 
5:44 AM
yeh ! so it was :P
 
user1357851
this is so wrong:
 
user1357851
 
that cat must of had one heck of an orgy
 
0
A: C++ cannot call some functions

Cheers and hth. - AlfFirst, a point about terminology: in C++ the term method is never applied to free-standing functions, only to member functions. And as you can see below, your example only makes sense for free-standing functions, so using the term “method” is quite misleading. In C++ something must ...

^ I got a downvote on that. I am thinking about leaving SO for good.
but then, i'm pretty stupid thinking that moving would solve the problem
oh my, some rage downvoter: -36 in rep points today
 
user1357851
Winners never quit and quitters never win, those never win and never quit are just idiots
 
user1357851
5:58 AM
<-idoit
 
That's hilarious.
 
@Cheersandhth.-Alf Who did you piss off?
 
i don't have any idea. i haven't even corrected anybody the last few days
 
@Cheersandhth.-Alf This is probably gonna get rolled back.
 
yes, for sure
what gets me is that someone feels enough hate or whatever to do that, repeatedly over many years
 
6:03 AM
Hi all
 
it is of course just a hypothesis that it's same person, but i don't think i've managed to piss of so many persons
 
If you get several downvotes across several answers in a short amount of time, it's pretty safe to assume it's a single person.
 
That applies to upvotes as well.
 
Indeed.
I think the best would be to upvote some posts, and downvote others. Sends some great mixed signals.
 
Yeah, I dunno what the script does if the serial voting involves both up and downvotes.
Though the serial voting script does take into the timing between the votes.
5 upvotes in a short amount of time on the ape's operator overloading FAQ gets reversed.
Presumably the user read everything, and did all the upvotes at the end.
And yet, I've been serially upvoted with 10+ votes before - but they were all spaced out with several minutes between each. Presumably, the upvoted did in fact read before upvoting.
Though I'm not sure if the same voting algorithm applies to both up and downvotes.
 
user1357851
6:15 AM
If you get downvoted by a few people on a single post in a couple of minutes you can safely assume you have pissed off a few people ... or one person who have multiple accounts.
 
Or the answer was simply wrong and someone linked it from somewhere.
I've had that happened to me before. I had an answer with one incorrect statement. litb linked it here, and I got like 4 downvotes on it in a really short amount of time.
 
Does any one know a simple method for getting the contents of an character array up until a space is found?
 
That sounds like [begin, find(begin, end, ' ') ).
Change to find_first_of or find_if depending on what 'until a space is found' means.
 
I am working with 'char*' can those functions be use?
 
Yes.
 
user1357851
6:25 AM
@Cheersandhth.-Alf I dunno, if some one hate and downvote you for years, I can only say there is something wrong with the other person, unless you encourage the other person by doing the same thing
 

« first day (762 days earlier)      last day (4169 days later) »