« first day (1785 days earlier)      last day (3164 days later) » 

7:01 PM
Is there a way to have certain functions in a class template get compiled only if a specific template parameter is used? I'm using static_assert right now in the function body. Is there a more accepted / better way of doing it?
 
Why do you want to prevent compilation?
 
@Prismatic Can you clarify what you mean by 'compiled'? The implicit instantiation model kinda makes things work out just right, so I can’t quite tell what you mean.
 
template<typename T> class Thing { void Add(T,T) {} }
I only want Add to be part of Thing<T> when T is int
(as an example)
 
In your example static_assert won’t work, it’ll make the whole of Thing unusable if/when the assertion triggers, not just Add.
 
@Prismatic The best thing you can do is inherit from a base class or similar when T is int.
 
7:08 PM
Conditionally-enabled parts of a class interface can be handled by SFINAE or partial specs.
 
specializations aren't always that great if you want to extend rather than replace the base interface.
 
@Prismatic: That's fairly straightforward, but has some tricky parts
First, Add has to be a function template
Right now it's a regular function of a class template
 
To clarify I don't want the code to compile if something like Thing<string>::Add(a,b); is called
Which static assert does already
 
You'll need something along the lines of template<typename U, std::enable_if_t<std::is_same<U, T>::value and std::is_same<T, int>::value> void Add(U, U) {}
Sorry that second template parameter, the enable_if, should be typename = std::enable_if_t...
Then the function Add only exists if the template parameters to your class are both int.
 
Is that method better than using a static_assert though? Is it more common to do that (thats sfinae right?)
 
7:14 PM
Yes, that's SFINAE
And which is better depends on what you want
The enable_if version I showed works well for further enable_if. You can then test whether this class has a callable member function Add and it will work as expected
If you don't expect that to happen, static_assert will give you a better error message.
There is a fairly large group of people in both camps
The static_assert version has the advantage of being much more obvious what you are doing
 
@DavidStone enable_if_t, at least the standard one, gives far worse error messages than plain enable_if :/
(Points at the alias, not at the place of invocation.)
 
@Griwes: I don't believe that is true in this case.
Let me check real quick
 
It's true in all cases. The actual error points to the definition of enable_if_t, because that's where ::type is accessed.
 
@David Stone I guess there's more utility in the sfinae way because you can test if the class has an 'Add' method as you mentioned. But in terms of clarity static_assert is pretty great. Maybe seeing c++ that isn't super ugly is what feels weird about it
 
@Griwes: At least with clang 3.6, both error messages are about as good
 
7:18 PM
> about
 
IIRC didn't they have to specially handle enable_if_t because the error messages were so fucking bad originally?
 
I'm pasting the errors
 
static_assert mandates you pass in your own error message no?
 
Not in C++17.
Or was it 14?
Anyway, the error message is now optional, but at least GCC 5.1 still didn't have that implemented.
(Clang had for some time now.)
 
C++17 allows static_assert(condition);
enable_if does look slightly better
 
7:21 PM
@DavidStone Notice line 15.
 
Yes
 
It points to the definition of enable_if_t.
Not to the actual disabling expression.
 
I'll be honest, though
 
It's much worse than the first one.
 
In practice I usually just get to "no matching function for call to" and ignore the rest of the error message either way
And just look at all candidates
 
7:22 PM
(Imagine this same situation with a dozen possible overloads in multiple files.)
 
Fair enough
 
@DavidStone You haven't been debugging any templated code lately, have you?
 
heh
 
@DavidStone It's way better.
 
@Griwes: I've done a bit...
 
7:23 PM
So you don't know the actual darkness.
:D
 
@Griwes: I gave a presentation at C++ Now entitled "Type Deduction in C++14"
 
It’s GCC vs Clang IIRC. I never get pointed to enable_if_t or similar.
 
Doesn't quite match C99 preprocessor metaprogramming, which was another topic, though
 
AH! I knew I knew your name from somewhere, just failed to match it properly.
Michał Dominiak here. The Polish student-volunteer.
 
whose name?
 
7:26 PM
David's.
 
Yeah, I remember you
 
@DavidStone yup we all do that. And it works in~95% of the cases
Until indeed you run into a get<>() that doesn't do what you require. Spice it up with failing sfinae and a bit of ADL and you'll have a fun week
 
user1804599
hi
 
@MarcoA. wow, really pushing that meme eh
have you submitted it for approval to the meme community yet
 
7:41 PM
I was really impressed at how much of a moron a user can get on SO
hence the paper
 
user3047181
@MarcoA. what's the context?
 
@MeltyButter you must be new.. it all started like this
 
user3047181
well maybe pointer formation is well complicated in brainfuck
 
We need a page for Lounge memes
Cat will probably disapprove even though he started one of the ~memes~
 
user1804599
As long as you state there that the meme of intentionally misspelling names of things is utterly retarded and should be avoided whenever possible.
 
7:46 PM
We have memes?
 
We have ~~memes~~?
 
That thing with the tildes is a meme, dude.
 
user3047181
@elyse ooooh marco are you gonna take that?
 
One that im not aware of apparently =/
 
7:48 PM
it's not a meme, it's just a sarcasm indicator
 
holy shit im only halfway through Hotline Miami
considering how bad i am at this game i may never finish it =/
 
I'm lost. In Köln
2
And it might be too late to find food at this hour.
 
user1804599
Keulen.
 
user1804599
@R.MartinhoFernandes Look in the trashcans.
 
@R.MartinhoFernandes We had nice aurora over the tent this week. Big trouts in the lake.
 
7:54 PM
Ffs even the döner stands close at 22.
This city sucks.
 
on a Saturday?
Fail.
 
user1804599
I played 22 hours of MGSV already.
 
@Borgleader best part of the vid: the YT comments:
> Since nobody is gonna read this i just wanted to say that i have a small dick -- Evolved Cockroach 23 hours ago
 
@sehe Jimmy Kimmel made a video reacting to the comments, he highlight some pretty good ones
 
Oh. Torn.
Do I bother to find it
@Borgleader No! I don't :)
 
8:10 PM
mumble bitches
 
@thecoshman git in the room

Marmalade II

Marmalade II room
 
Found a Mexican bar thingy that makes burritos
 
Is that good?
Sounds terrible.
 
98% on rottentomatoes (audience score 95%)
and 9.1 on IMDB
(disclaimer: havent watched it)
 
8:20 PM
Mainstream media trained me to assume anything with an interesting synopsis is crap.
@Borgleader is that beyond the pilot?
 
user3047181
i only watched the pilot, but the main character said he uses linux in it, so i though it was pretty cool
 
Pilot reviews are not good indicators because the pilots are crafted carefully to bring the audience in.
 
there are 9 episodes out already according to this page but idk if the reviews were only for the pilot
 
@Mr.kbok why?
 
@thecoshman not everyone's on mumble
 
8:22 PM
I'll probably have to wait for it to come out on bluray or netflix before i can watch it anyway
 
@Mr.kbok vOv fuck em
 
The imdb reviews mention mostly the pilot, except the ones that mention how it crashes and burns afterwards
 
@R.MartinhoFernandes Hmm so only the pilot is good?
what a shame
 
Impressive answer. Something I didn't know. And with helpful documentation quotes and links. What else could we ask for :) — sehe 6 secs ago
@MeltyButter usually a red flag (if it's worth noting, then it's most likely not actually 1337)
It's sad that we still have the flagger. Oh well. We'll just notify the smurfs if it continues
 
8:46 PM
Did someone call me?
 
It seems you have things upside down
 
have you guys finished the marmalade? madewithmarmalade.com
 
@MarcoA. whats that
 
someone who crapped with unicode I suppose
or with something else
 
9:01 PM
@BartekBanachewicz that album isn't on spotify. here's for your enjoyment only 9a35796c-9c41-4b95-93e9-0005bacd7e5b.s3.amazonaws.com/index.htm
awesome
 
@sehe why are you searching for polymorphism on wikipedia?
 
@sehe torrenting like a pro
 
@BartekBanachewicz That was my own rip, though
 
@sehe mark it as duplicate, you repbear
 
9:07 PM
@BartekBanachewicz I probably should have deleted that but I forgot to be in time. If you dl/ed it, I'll drop it
 
@sehe wow I haven't seen misconfigured MIME types in a long long time
 
@MarcoA. why?
 
@sehe yep, done.
 
isn't it a dupe?
 
@milleniumbug I've seen missing mime types breaking our upgrade software recently :|
@BartekBanachewicz all tracks? You're quick
 
9:08 PM
I didn't read it though
 
@sehe 100Mbps
 
inb4 that's what she said
 
@sehe ouch
 
@BartekBanachewicz 200Mbps here :) na na na na na
 
but I have 100 upload as well :P
 
9:09 PM
neener neener
 
@BartekBanachewicz Me too
 
Aaaaand it's gone. I hope you appreciate I hand-crafted that index.htm i.imgur.com/q4B9xiY.png
@BartekBanachewicz Should I re-upload :)
@MarcoA. Oh. I see now that the c/v happy crowd misclassified that as the dupe.
Anyone with reading comprehension should realize the question is ginormously X/Y though
So, adhering to the question title is preposterous IMO. I mean, c/v, downvote all you want, but it's not a dupe, like I think the other answer was just irresponsible
 
X/Y is cool
Jon Clements wasn't clear indeed
 
@sehe naa :)
 
user1804599
9:37 PM
I am addicted.
 
Me too.
To what?
 
user1804599
To what?
 
user1804599
To MGS V.
 
What is that :/
 
user1804599
A video game.
 
user1804599
9:41 PM
Now it's time to program.
 
user1804599
Ok what to make.
 
@elyse jquery plugin
 
Makefile
 
omfg... this fucking boss
 
user1804599
NO.
 
9:41 PM
i know this is supposed to be a hard game
 
user1804599
How about something fun?
 
but ffs
 
user1804599
I accidentally killed a child soldier.
 
user1804599
And the mission failed because of that.
 
0
Q: char pointer initialization compared to non pointer? What happens

Hugo PereaQuestion Answered -Thanks I know you cant do this with a normal char. char line1 = "hello"; but you can do this with a pointer to a char type char* line2 = "hello"; I wanted to know why this is, what happens in the second line of code? Why is the second initialization possible? Is...

> Question Answered -Thanks
LOL
 
user1804599
9:44 PM
dat avatar
 
Flagged the flaggot for mod attention.
 
gaaaasp
The words I needed earlier were 'push' and 'pull'
0
Q: The Observer pattern using the pulling mechanism

USer22999299I was wondering about the following implementation of public void update(Observable obs, Object arg) while i want to send to all of my observer and update using notifyObserver() i and passing a references to this the observer can use the getters from the subject to pull the information he wan...

 
user1804599
I want to write something in an imperative programming language.
 
PropertyPushNotify<T>
hmmmm
@elyse javascript
 
again
 
9:51 PM
Filthy flagger staph
 
Psst. Everybody keep cool. It's why I mod-flagged.
 
@elyse or how about processing? something where you get visual output immediately so its more satisfying
 
user1804599
What is processing?
 
a language I think
 
@elyse Followed by: "what's cooking?"
 
user1804599
9:54 PM
Processing is an open source programming language and integrated development environment (IDE) built for the electronic arts, new media art, and visual design communities with the purpose of teaching the fundamentals of computer programming in a visual context, and to serve as the foundation for electronic sketchbooks. The project was initiated in 2001 by Casey Reas and Benjamin Fry, both formerly of the Aesthetics and Computation Group at the MIT Media Lab. One of the stated aims of Processing is to act as a tool to get non-programmers started with programming, through the instant gratification...
 
user1804599
> with the purpose of teaching
 
user1804599
boooooooooooooooooring
 
I think it makes more sense in my mind to template Property on the type of notification like Property<T,Notify::Push> rather than use inheritance PropertyPushNotify<T> but inheritance works out nicely in code
@elyse Look at some of the stuff people have created with it, it looks like a lot of fun
 
user1804599
no
 
@elyse pfff...
> Oz is a multiparadigm programming language, developed in the Programming Systems Lab at Université catholique de Louvain, for programming language education
Oz is a multiparadigm programming language, developed in the Programming Systems Lab at Université catholique de Louvain, for programming language education. It has a canonical textbook: Concepts, Techniques, and Models of Computer Programming. Oz was first designed by Gert Smolka and his students in 1991. In 1996 the development of Oz continued in cooperation with the research group of Seif Haridi and Peter Van Roy at the Swedish Institute of Computer Science. Since 1999, Oz has been continually developed by an international group, the Mozart Consortium, which originally consisted of Saarland...
and guess what?
it sucks!
 
9:55 PM
@elyse on the contrary. Those "for the purpose of teaching" are frequently the most evil
 
take a look at the samples, I've never seen a less-perverted syntax
uff.. annoying flagger.. Jon will be happy though
 
@MarcoA. izzamapoint. How many are there? turtle, logo, modula2, karel etc.
 
@sehe uh you probably remember more than I can.. but definitely too many
it was flagged, right?
 
user1804599
@sehe greenfoot is a library.
 
@elyse what about that game you were making
 
9:58 PM
Huh, no StarGazer on this machine. I feel naked.
 
was that in an imperativel language
 
are there games made in a functional language?
I can't even imagine how, but I'm not a subject expert
 
user1804599
@Prismatic which one
 
I once wrote a raytracer in Haskell. It was deterministic and shit.
 
reet racer
 

« first day (1785 days earlier)      last day (3164 days later) »