« first day (897 days earlier)      last day (4052 days later) » 

Xeo
9:04 AM
@StackedCrooked Very very similar, yeah.
 
Don
@LucDanton Well it obviously seems like I'm missing something here ;x I googled the difference too just to be sure and I do seem to understand it but still, I might be wrong.. and according to what I know this should work: in the header have: MyClass foo; and in some other function such as main() - foo(paramaters); I hate being such a bother but.. I'd really appreciate any help ;I
 
MyClass foo; is not just a declaration but also a definition. It shouldn't be in the header.
45 mins ago, by Luc Danton
No; that would still define a global variable in the header, and define a local variable in main.
I've told you so before.
 
yes, and the local would be used instead of the global in your code because it's closest to your scope
 
Don
So basically without a pointer it's impossible to declare a global variable while still passing it values?
 
It's perfectly possible.
45 mins ago, by Luc Danton
Then declare in the header, but don't define there.
I've also told you that.
 
9:11 AM
use a different variable name :v
 
@Magtheridon96 No.
 
Don
Haha you did. but I'm clueless. how would you do such a thing?
 
Now that is the right question.
Declare as extern MyClass foo;, define as MyClass foo(/* arguments to constructor go there);. The definition, much like the declaration, must be at namespace scope.
Do note that if you don't want to pass arguments to the constructor you can't define as MyClass foo();. That would declare a function instead -- it's a bit unfortunate.
 
Don
So extern makes it declare without defining pretty much?
 
Yes.
 
Don
9:14 AM
Sweet, and about the last sentence, it means that MyClass foo(arguments here) is valid, but without arguments I'll need to do MyClass foo; , correct?
 
Yes.
 
Don
Thank you so much :3
 
Hey @don, anything you wanted from me?
 
With C++11 you can use braces instead, it avoids the problem altogether: MyClass foo {};.
 
Don
Oh, nope @BartekBanachewicz , just wanted to say hello :) it's been a little while
@LucDanton yeah it's less confusing that way
 
Xeo
9:16 AM
@Stacked: Btw, folding is also easy, but not the functional-style one without assignment. swallow{ (void(acc = f(acc, std::get<Is>(t)), 0)... };
Maybe even with acc as a variant.
@LucDanton, your input?
 
Let's see.
Mine is recursive because I don't assume that the result always has the same type.
So e.g. I can fold over std::tuple<int, long, int*>.
 
Xeo
I can too, as long as f unifies them somehow :P
But yeah, I think the "true" folding can't be done with indices.
Or rather, with pack-expansion
 
If it helps the pattern to be expanded is f(a, f(b, f(c, ... f(z, zero)) ... ) for a right fold.
 
Xeo
But you can't expand an incomplete / nested expression, as far as I know
But looking at the pattern, it seems like some kind of funtion composition.
Not sure how much that helps, though
Since the composition itself will then likely involve recursion
Erm.. anybody else who can't use left-arrow on Coliru anymore?
 
9:34 AM
I can't
For a moment thought the key has broken
 
@LucDanton that'd be like this: void f (stack<T> args) { if (args.size() < 1) return; T arg = args.pop(); f (args); }
 
No.
 
it starts like this: f ( new stack<int>({ a,b,c, .. z }) );
 
This misses the point of heterogeneous types completely (there's std::accumulate already), does not fold, is pointless, and is wrong.
 
you can accumulate: int f (stack<int> args) { if (args.size() < 1) return 0; int arg = args.pop(); return arg + f(args); }
 
9:44 AM
No shit sherlock.
 
Xeo
@Stacked: You done borked! Can't use left-arrow anymore on Coliru. :<
4
Well, atleast ctrl+left arrow still works.
 
Why am I getting Inboxes on StackOverflow for messages I've already seen in Chat?
Could've sworn I clicked the green indicator on top of my avatar
 
Don
@LucDanton Hey, about the extern thing.. it can't be inside of a class? I did: extern Foo foo; under private but it tells me this : "Invalid storage class"
 
@Don Yes, that's for variables at namespace scope.
 
Don
I see
 
9:55 AM
2 hours ago, by Luc Danton
@Don Assuming C++11 you'd go Foo foo { bar, baz }; or Foo foo = { bar, baz };.
Original advice, if you recall, did apply to a non-static data member.
 
"Foo foo { bar, baz }; or Foo foo = { bar, baz };" what's the difference ?
 
Don
So for the sake of learning, how would I be able to do this without extern while keeping the member private?
 
The advice applies regardless of access control.
@Don Here, have an example. Obviously there's only one 'file', so to speak, but this class definition can be moved to a header without a change.
 
Xeo
10:16 AM
Hmm... log N composition should be possible, eh.
 
Don
@LucDanton I.. don't understand how to use this to solve my issue ;xx That's what I pretty much want to do: coliru.stacked-crooked.com/… could you show me how to solve this using your last example please?
 
@Don What about this?
 
Don
Oh that's neat ;o
But that's.. c++11?
 
Yes.
For C++03 you'd initialize bar to &foo in a constructor.
 
Don
Which means.. Foo foo(Bar &bar); or something? o.o
 
10:27 AM
Example with the same semantics as the previous one.
@Don That would be a new declaration; we don't want that.
 
user1357851
why don't you have a customized avatar?
 
(It would be a new declaration because we're in a new scope. Getting technical though.)
 
Don
Gotcha
Can you initialize more than just bar that way by the way? like.. myApp():bar(&foo):another(&foo){}?
 
Ell
Coliru needs to support tablet!
 
@Don You separate with a comma. By the way, when initializing a member with another member you need to be aware of their order of construction.
Isn't there a canonical Q&A for order of initialization of members? :s
 
user1357851
10:37 AM
we are being invaded by people with no customized avatars :p
 
Gravatars are a sin
REPENT
 
Don
xD
 
Doesn't appear to be an entry in the C++ FAQ either. Oh well.
Order of initialization is order of declaration of the members in the class definition. Not the order of initializers in the constructor.
 
Ell
My gravatar is this image iirc
 
Don
C++ is so confusing, especially after coming from Java for some reason
Oh I see @LucDanton So what you're saying is that if I have myApp():bar(&foo){} it also means that these definitions must be in this order pretty much? Foo foo ; Bar bar;
 
Xeo
10:41 AM
Meh, fuck proper folding with indices.
 
Some style guides/coding standards recommend or mandate that the initializers in a constructor should always match that of the declarations in the class definition, to avoid misleading the reader. It's not bad advice.
 
Xeo
It's going to end up with recursion in any case.
Either linear or log N
And the recursion either happens directly, or when building up the composed function.
 
user1357851
@StackedCrooked we need to make you site mobile app-ish sometimes ... so people can use their phone to compile code at parties/meetings. I know it's very geekish but it would be fun :p
 
Don
@LucDanton So what you're saying is that if I have myApp():bar(&foo){} it also means that these definitions must be in this order pretty much? Foo foo ; Bar bar;
 
10:47 AM
Strictly speaking, they don't have to. Which is why it's mentioned in style guides. In your case though, presumably when a Bar is constructed from Foo* they expect an actual Foo object behind the pointer -- so you'd want foo to be constructed when you pass &foo to the constructor of bar.
 
Don
Gotcha
Alright, thanks for the info :)
 
user1357851
april first in 3 hours!
 
Don
*Goodbye Gravatar , hello Koala *
I don't see it here though, hmm lets refresh
 
user1357851
It will take sometimes for your new avatar to be pushed through
 
Don
Ah yeah I see, >.>
Oh well
 
10:53 AM
6
Q: C++11 "enumerated types" (17.5.2.1.2)

PowerGamerA quote from C++11 standard (17.5.2.1.2 Enumerated types): 1 Several types defined in Clause 27 are enumerated types. Each enumerated type may be implemented as an enumeration or as a synonym for an enumeration (Such as an integer type, with constant integer values (3.9.1)). 2 The enumer...

 
@Telkitty you prepared your April Food question ?
 
you might want to look at that ^ @Luc
 
user1357851
@KhaledAKhunaifer I was thinking misleading avatar
 
user1357851
but food question shall be cool too ...
 
user1357851
y u here so early :p
 
10:56 AM
@Telkitty exciting .. food question, that can be fun
isn't this the time when sun and moon meets
 
Also I just showed Celldweller to my lil brother
I wonder if he will like it
 
@ScottW sun and moon were meaphors for you and @Telkitty
 
user1357851
I am the sun 4 sho? Bigger than brighter? :p
 
@ScottW take care
 
Time to work on Lundi for a while
I finally ate and slept well
 
11:06 AM
@BartekBanachewicz Lundi ?
 
@KhaledAKhunaifer Lua C++ API project
 
It's still dimanche here.
 
extern in C++, I understand that it externalize linkage .. am I wrong ?
 
@MartinJames "dimanche"?
@KhaledAKhunaifer it's easily googlable
Also I should really start building my code as x64
 
11:09 AM
yes, you should
 
-1
A: How to use lambda function as hash function in unordered_map?

Tony The LionIt may look something like this: auto my_hash = [](std::string& foo) { return std::hash(foo); }; std::unordered_map<std::string, int, decltype(my_hash)> my_map;

wait my answer got downvoted
but the other answer, essentially the same, is upvoted
WTF is going on?
 
I wonder how it will affect linking to C libraries
 
it's not essentially the same at all
your answer is incorrect, and his isn't.
as he clearly states
> You need to pass lambda object to map constructor, since lambda types are not default constructible.
which he correctly did, and you incorrectly did not.
 
object, @Tony
I recently fucked that too, I believe
 
11:11 AM
meh
 
user1357851
A SQL query goes into a bar, walks up to two tables and asks, "Can I join you?"
 
Anyway I think I can memcap Minicraft at 2GB quite easily on stresstests
so it only makes sense to use x64
 
Xeo
Oh hey, the Puppy is alive.
 
But I've tried x64 Lundi now, just for kicks
 
like most jokes you tell Telkitty, it was both not funny and completely overused
 
11:12 AM
@Telkitty this joke is as old as it comes
 
and it threw unresolved externals from Lua at me
 
@BartekBanachewicz I thought that the whole point was to use less memory and shit
@BartekBanachewicz You did recompile Lua for x64, right?
 
@DeadMG stresstests
 
and shit?
 
user1357851
@TonyTheLion & this:
 
user1357851
11:13 AM
When your hammer is C++, everything begins to look like a thumb.
 
@Xeo Of course I'm alive
@Telkitty Just as bad.
 
@DeadMG Nah. Apparently I should
 
Xeo
Didn't see you the last few days.
 
@Telkitty also old, now go away
 
fuck I am going to supply all libraries as source
it's really easier than maintaining binaries
 
11:13 AM
@BartekBanachewicz x64 and x86 cannot be intermixed in the same process. If you go x64 every component must be x64.
 
@DeadMG TIL
I thought it's possible.
 
so again, I will need 64bit FreeImage
 
the only way around this is interprocess communication, which is a bitch and totally overkill unless you have to maintain backwards compatibility with, say, x86 binary plugins.
 
Thank god pugixml has header-only mode
the downside is that I willl have to write my own build scripts for each of them
Meh, linux wins here clearly
@DeadMG yea, that doesn't make sense
 
11:15 AM
what do you mean?
 
in terms of MiC
 
ah yes
it doesn't make sense for the vast majority of applications.
pretty much the only situation where it is called for are x86 binary plugin compatibility.
 
Xeo
You're annoying.
 
:8577089 Still old and tired.
 
11:16 AM
did you just rip all of these from the Programmers Jokes question/
 
guys, you are loopholing the ignore system
 
because we've all read it long ago
 
you are talking to someone whose existence I deny
 
yeah
 
Xeo
@BartekBanachewicz Duty Calls etc.
 
11:17 AM
I dunno why I un-plonked Telkitty
he can go right back on the list
 
he's back on my list
 
I also re-read Variadic TMP chapter in Primer yesterday
i think I now understand variadic pack expansion a bit more
 
what?
I can't C++ a bit less!
 
you didn't get the joke
 
11:20 AM
a tiny smidge
also, you fail at joke, bartek
 
Whoooosh
yeah, I failed.
 
why did the programmer fail to see why his integer was being incremeted?
because he can't C ++
 
user1357851
I am going to troll SO with my April fools day joke, currently doing some research
 
BAZINGA
 
11:20 AM
fail
 
2x lol vs 1x fail
 
srsly, there are basically no funny programmer jokes
 
oh come on
we all need a laugh time to time
 
@DeadMG don't start like Cat
 
11:21 AM
exactly
 
and I would greatly appreciate one
but apart from a couple I saw in the programmer jokes question, they're all really bad puns
 
Puns are funny when they're bad
 
user1357851
@DeadMG that's as true as you saying there is no female in this lounge at moment - so totally misinformed
 
Tony's one with ... is good.
 
a type and a non-type walked into a bar...
oh wait
 
user1357851
11:24 AM
I just realised this lounge is laughing at PHP people the same way Java people will at Perl people
 
y'all moved your clocks forward one hour, right?
 
user1357851
no
 
yupppers
 
Who do Perl people laugh at?
 
@TonyTheLion yep
 
11:24 AM
Scheme
oh good
10 hours ago, by Etienne de Martel
@Borgleader Tomorrow is March 31st.
out of context, its weird that this is starred
 
I should put some clothes on
 
It is a good idea to write a simple console buffer for Win32 right, because cmd.exe sucks? It can't be too hard, can it?
 
lazy bum.
@rubenvb what happened to modding Console2?
 
@BartekBanachewicz hmm.
I don't know how that would interact with stuff like WriteConsole.
I'm thinking a plain WriteFile or just some buffer in memory is simpler and just a lot better.
Takes away lots of crappiness wrt to "Windows console sucks" that people hate about Cygwin/MSYS.
 
well, yep
We could use normal terminal
I can sign up for betatesting
 
11:31 AM
Just basic black and white, and functional copy-paste.
@BartekBanachewicz I am not promising an ETA in the near future.
 
@rubenvb just put it on GH
or bbucket, dunno what you use
 
@BartekBanachewicz will do.
 
user1357851
@Xeo you = Mysticial - Lightness Races in Orbit
 
kewl.
I have to test out nightcracker's version
i didn't have time for that
and now I am on my work laptop so...
 
user1357851
Xeo, you are almost this most annoy person ... without a personality
 
user1357851
11:34 AM
It is like annoyance with a face or body, just annoyance
 
holy crap win32 GUI code O_o
ribbon or no ribbon :P
let's fire up ye olde MSVS2012
 
MFC needs VS right (ie doesn't work with MinGW)?
 
Wots up with win32 GUI that could have been foreseen when it was designed, so long ago?
 
oh wow, the VS2012 help menu opens the web browser.
 
11:48 AM
@rubenvb I think so
@MartinJames backward compatibility fucking everything over
and now they use C# for gui anyway
 
Now downloading 1.6 GB of help docs
Maybe stupid, but hey, I got bandwidth to spare.
 
I am not even trying to write GUIs anymore
it's just too fucking annoying in C++
 
I'm happy with basic functionality right now.
And combining two languages potentially not compilable by MinGW is a nono. Adding Qt is not the intent.
 
I just finished installing MSVS2012
Need to restart my computer and it'll be ready for usage
These 14 hours of waiting lead up to this moment and it better be worth it
 
lol you're in for disappointment
 
11:52 AM
yea
 
the compiler is a joke
a sad joke
 
hmm rich edit vs normal text edit controls
 
rich!
I want bold stuff in vim
 
bleh, brb
 
11:54 AM
Fucking Easter, I haven't eaten this much food since Christmas.
 
oh yeah, if I want colors and stuff I'll need rich prolly
 
Food is good
 
I can't feel my chest.
Pepsi should help.
 
Oh god WHY THE FUCK DO I NEED A POPUP ABOUT CAPSLOCK ON FOR HALF OF THE SCREEN YOU FUCK
aDASDASFASFAs
 
Well 4 more hours before sleeps. Might as well do something useful... Or watch Star Trek: DS9.
 
11:57 AM
this is going to be a painful experience...
 
First time anal?
 
I remember my first time anal.
When I was 4.
My uncle wanted to play a little game ;_;
 
@Magtheridon96 You were raped by VS as well?
 

« first day (897 days earlier)      last day (4052 days later) »