« first day (314 days earlier)      last day (4636 days later) » 

9:00 AM
that specialization is wrong
 
8 mins ago, by R. Martinho Fernandes
Forgot a ::value above. And a ::type and a typename.
And it shouldn't be a specialization if you're going with std::is_same.
Because, it still won't pick the specialization for is_string<std::string*>.
 
@RMartinhoFernandes yea exactly, so perhaps my intent isn't entirely clear
or I don't get what I'm doing
lol
 
It almost works. Now you need to deal with the fact that you can't use . call syntax on pointers.
 
Solution: more traits!
 
I won't ask.
 
9:03 AM
meh
 
I've been really liking std::reference_wrapper lately.
 
I sometimes half-heartedly wish std::decay would transform them to T&. But it affects assignment so not really.
 
I've mostly used it with bind.
 
There's a great article about java here : chaosinmotion.com/blog/?p=622
 
Does it bash it?
 
9:08 AM
If your eyes can still stand Java code.
Yes, but not Java itself, more the "best practices" which makes my life miserable.
 
sbi
@CatPlusPlus We never understand you. We do tolerate you anyway, though.
 
> Grouping subexpressions affect the order in which they are evaluated, so it does matter when you have function calls in such an expression. And the test is not valid because it does not cover the side effects one function might have. Think what happens when you have system calls inside those functions.
This is nonsense, right? click me
 
@kbok Oh, I read that before. Someone posted a while back.
@sbi Yeah, so what?
 
@RMartinhoFernandes Ok.
 
sbi
@RMartinhoFernandes Mhmm, this is weird. is by no means my second-to-top tag.
 
9:10 AM
HA!
We all have some embarassing truth.
 
sbi
Anyway, my score is >4k. :b
 
meh, not as impressive as you guys
 
Maybe they'll make platinum badges one day.
 
sbi
@TonyTheTiger Funny. Why isn't the first tag here?
 
And on the same day, Jon Skeet will get them all.
 
9:12 AM
@sbi not sure
 
@foobar In the case of the OP it doesn't matter, but in the general case it's actually true.
What do you mean by "nonsense" ?
 
@TonyTheTiger At least you have sensible tags.
 
sbi
@TonyTheTiger Is that an euphemism for "I dunno"?
 
@CatPlusPlus Sometime ago you got one of those notification bars per badge. I imagine that some users would get half their screen orange in the morning.
 
Orange, I see orange.
 
9:13 AM
@TonyTheTiger That's funny, you chose "Europe" as your location.
 
Good thing they got rid of the orange on favourite update.
Good lord, that popped up every 10 seconds.
 
You were stupid enough to favorite "Hidden features of Foo?"
I should really pick one of American or British spelling and stick with it.
 
Yes. :(
 
@kbok I mean that the following statement is nonsense:
> And the test is not valid because it does not cover the side effects one function might have.
Because clearly, std::cout << message is a side effect.
 
@kbok it's ambigious enough
@sbi yea essentially
 
9:16 AM
Europe is cool.
 
@CatPlusPlus sensible?
 
@TonyTheTiger Not PHP.
 
sbi
@TonyTheTiger But we all know you're a Spaniard! Why not admit it?
 
@TonyTheTiger Not Java.
 
@foobar Well, (std::cout << foo) << bar is different than std::cout << (foo << bar).
 
9:18 AM
&& is the operator at hand.
 
But that is not at all what I asked!
 
If && is overloaded it's the same.
 
@foobar Oh, I see. Well, npclaudiu is assuming the OP doesn't know anything about short-circuiting, so I think that's what he meant by "not valid".
 
If && is overloaded, it's not short-circuiting.
 
I don't like PHP and I have no knowledge of Java, except that it sucks and it's fun to bash it
 
9:19 AM
@TonyTheTiger Lol.
 
Anyway, he has to read the question. Don't bother discussing with him if he doesn't.
@foobar True, but everyone knows that overloading && is evil for that matter.
Oh, I didn't see you were the OP.
 
My question is specifically about short-circuiting, so by definition I am not asking about overloaded &&.
 
@foobar He's explaining to you what short-circuiting is because he didn't understand your question.
 
@kbok He's already past that.
 
It's turtles all the way down.
 
9:22 AM
@kbok Oh, I see. I was assuming people read questions before they answer them.
 
He's saying that the test @foobar showed does not cover side-effects.
Which is just stupid.
std::cout << "side-effect" is the canonical side-effect.
 
This chat is weird. It either scrolls to the bottom forcefully, not allowing me to scroll up at all, or stops scrolling altogether.
 
That or missiles.launch().
 
What about std::side_effect<>?
 
Why the template?
 
9:24 AM
Templates are cool.
 
lol, I'm still confused with my type traits
meh
 
Template templates are even better.
 
Sadly, you can't do that.
 
@RMartinhoFernandes Do what? Template template parameters do exist.
 
Templates made with macros.
 
9:25 AM
I wanted to use a combination of my is_string and is_pointer type trait to get my algorithm_selector<true> to run, but somehow, it doesn't work
 
But "template template parameters" are not "template templates".
 
I see.
 
Templates ! I had to explain templates to my interviewer the other day. He was happy.
 
I'm talking about template <typename T> template <typename U> class Bar;.
 
God, you are all so pedantic. I love this chat.
5
 
9:26 AM
template members of templates are template templates…
 
@TonyTheTiger Have you considered unit testing your traits to make sure you have the desired behaviour?
@foobar Hi. Welcome here.
 
@foobar We collectively swing between pedantic and horny. It's a wild ride.
 
He used "collectively", "horny", "wild", and "ride" in the same message.
 
And "swing"!
 
9:27 AM
@RMartinhoFernandes so did you!
 
-7
Q: Re: Làm đèn từ chai nước ở Philippines

diaRe: Làm đèn từ chai nước ở PhilippinesRe: Làm đèn từ chai nước ở PhilippinesRe: Làm đèn từ chai nước ở PhilippinesRe: Làm đèn từ chai nước ở PhilippinesRe: Làm đèn từ chai nước ở PhilippinesRe: Làm đèn từ chai nước ở PhilippinesRe: Làm đèn từ chai nước ở PhilippinesRe: Làm đèn từ chai nước ở Phil...

 
what language is that?
 
vietnamese…
 
> Nice to see the low quality filter accepts Vietnamese posts about bottled water. – Matt 10 mins ago
 
> Could you try to write in Englisch language please?
 
9:29 AM
Something something Philippines.
 
Lol, ok, I'll do my best to write in Englisch.
 
@kbok Shure I kan.
I'd just like to make it clear that I was about to say something but I forgot what it was.
 
It's about making light from bottled water.
 
Oddly enough, I know what the repeated spam sentence is referring. It's using plastic bottles (filled with bleach) as 'light fixtures' of sorts (more like an opening actually) in slums.
 
@LucDanton You can read Gibberish Vietnamese?
 
9:32 AM
How do you know that ?
 
I don't usually watch television, but I did catch this on the news.
 
   Template<typename T>
    struct algorithm_selector<is_pointer<T>::value>
this isn't a valid partial specialization, but is there a way to make it valid?
 
There's some pretty cool bottles-and-cans architecture in New Mexico.
 
Someone had the idea and it snowballed in the Philippines. The big win is that people that work in the slums now can do so without burning petrol for lighting.
 
It's of the ridiculously expensive architect and upkeep variety though.
 
9:35 AM
@TonyTheTiger Yes, but I find it arcane. I'm writing you an example in ideone.
 
@LucDanton oh thanks :)
oh someone said "horny" and I missed it :p
we could have talked about sex, but I was lost in type traits
 
and not sure that sex and type traits go well in the same discussion
 
binary type traits? (Relationships Between Types?)
 
hahah
template<typename T> struct is_female { static const bool value = true};
 
sbi
9:39 AM
May 12 at 15:24, by sbi
@Raze Yes, but what I was trying to say was that, while most programmers are finicky, C++ programmers are anally so. :)
 
Anyone care to comment ?
 
sbi
@TonyTheTiger No, you didn't. You never miss these.
 
0
Q: Does abort run in ring 0

YuncyThese days i found a blog the mentioned abort function in C. The following is the source code of abort function http://cristi.indefero.net/p/uClibc-cristi/source/tree/0_9_14/libc/stdlib/abort.c I found that it use the hlt instruction (My PC is x86). But seems that the hlt must run in ring 0. (...

 
@TonyTheTiger ideone.com/w1dJ6
Have to use a dummy parameter
 
It's SFINAE at the template parameter level :)
 
9:45 AM
Yeah, that's the explanation.
 
@Luc, you forgot something.
bool_to_void is incomplete.
 
You write all your specializations as template<typename T, typename U, typename V, ...> struct trait<T, U, V, ..., void > .... Notice the last, dummy parameter must somehow end up as void to match the defaulted parameter.
@RMartinhoFernandes Yeah, I usually use a void_ helper + decltype these days.
So the SFINAE happens one level higher than that, void_ is just here to match the defaulted parameter.
 
Hello again gents
 
argh, grocery delivery is taking forever
 
Come on! Another question with someone thinking const_cast lets you cheat!
 
9:53 AM
and if I fall asleep, I'll miss my coursework deadline
 
Can someone recommend me a good place to start reading up on how to use the boost library?
I've read the "quick start" thing on the boost website and I didn't find it too helpful.
And the documentation is a little too thick for me to get a good handle on at this point.
 
@HunderingThooves You asked that just a few days ago. Boost is an agglomeration of mostly unrelated libraries, some rather old and some rather esoteric.
 
What part of boost do you want to use?
It's biiiiiiiiiiiiiiiiiiiiiiig.
 
I know, that's the thing that's daunting about it.
 
It's bigger on the inside.
 
9:57 AM
@HunderingThooves I suggest you start by coding anything you want, and use boost when you feel something is missing.
 
I see that everyone knows how to use stuff like Lexical_cast and I've never used it.
 
@HunderingThooves What do you want to do?
 
Well, I've been playing around a bit more with file interaction recently, I suppose that my end goal is to make something like....
 
Using boost for the sake of using it is rarely useful nor educationnal.
 
Lexical cast is for conversions like int to std::string. There you go, now you know.
 
9:58 AM
There was a website a while back called "isaword" that was made fully with C++ that seemed to rely heavily on C++
 
Websites in C++ are rather uncommon, but nothing new.
 
Do you have a link to a live site?
 
Rely heavily on boost*
 
@Potatoswatter ebay :)
 
It's no longer live potatoswatter
 
10:00 AM
Facebook is PHP compiled down to C++.
 
@LucDanton so it this SFINAE then?
 
Yes… C++ is good for any kind of high-performance programming. Google for example.
 
@TonyTheTiger Yes.
 
@TonyTheTiger It's one (arcane) use for it.
 
10:02 AM
hmmm
 
Well, if you can throw enough servers at a problem, you don't really need whatever more raw power C++ might give you.
(Okay, that one wasn't very English.)
 

SFINAE with template parameters

Aug 17 at 15:51, 26 minutes total – 29 messages, 6 users, 0 stars

Bookmarked 7 secs ago by R. Martinho Fernandes

 
Lol I get less englishy as time progresses.
 
@CatPlusPlus Throwing servers ata problem might solve it if the problem is, say, a cat or a dog you want dead.
 
This particular web app implements a custom HTTP server complete with HTML hardcoded into string literals O_o
 
10:03 AM
@CatPlusPlus You mean it was Englisch instead ?
 
@Potatoswatter That's why I was so impressed by it.
 
It's Cat English, you probably never heard of it.
That doesn't really make it a very good app.
 
@HunderingThooves Positively or negatively impressed?
 
Especially that HTML.
 
Some of column a, some of column b.
It's clear that he wasn't magical at html / css, but the implementation was pretty cool.
 
10:05 AM
"— There's a typo on the site! — Okay, fixed, let me recompile. 2 hours later"
 
There, they closed my rep faucet. Gee, what I'm I gonna do the rest of the day?
 
Chat.
I tried to implement Django templates in C++ once.
Didn't go so well.
(Well, mostly because I got distracted by another shiny thing.)
 
If you want to build from the basics for the sake of coolness, I suggest getting an embedded programming kit. They're reasonably cheap.
 
Any recommendations?
 
Get a machine with a megabyte or less, an ethernet jack, and blinking lights.
 
10:08 AM
write an OS !
An old PC will do the trick as well, no ?
 
I'm partial to Freescale. They have a free OS called MQX which is lighter than Linux.
 
A megabyte?! That's, like, 1 second of runtime.
 
Heh, that'd be interesting.
 
A megabyte is one eighth of emacs.
 
You can do a lot of things in 16 K.
 
10:09 AM
I started assembly on an old Amstrad PPC 512. This thing had two floppy drives.
 
Yeah, run 1/512 of emacs.
 
It's all voodoo.
 
Notice the handle.
 
Hmmm, PPC still has a fair share of the Top500…
;)
 
10:29 AM
so this is an example of SFINAE I found and I'm trying to use ideone.com/QvzaZ
but it's failing to compile, I guess I'm not using it correctly
 
@TonyTheTiger You're reading C++ Templates: The Complete Guide?
 
@RMartinhoFernandes I have it, but I'm not currently reading it, found that on SO
 
The idea is to use it on types, like this: IsClassT<int>::Yes would be false.
The test functions are implementation details (that's why they're private).
You will find this example in the book somewhere on Part III, I think. I immediately recognized the style.
 
@RMartinhoFernandes I don't get what the syntax error is about
 
test is private. But even if public, of the two overloads, only the second would be a candidate for the call. Problem is, there's no way to infer the template parameter from ....
 
10:35 AM
oh
 
And the functions have no definitions.
They're just a hack to get overload resolution to do the work for you.
 
ok, I better read up on
 
Having two complementary variables inside is like ECL logic.
 
Emitter Coupled Logic… an old bipolar system where half the circuit is high and half the circuit is low.
 
10:41 AM
what is the arg C::* in this line
template<typename C> static One test(int C::*);
never seen that before?
 
It's a pointer to data member of type int.
 
It's a pointer to member. Only classes can have members, so the (im)possibility of existence causes SFINAE which determines whether it's a class.
 
so basically it create a trait to determine wether something is a class, you need to use SFINAE, or can it be done without?
 
SFINAE is usually the right tool for the job for type introspection.
 
Damn "member to data member", WTF?
 
10:48 AM
void f(const char*, typename S<const char*>::type* = 0) supposedely this is not well formed and would be ignored through SFINAE, but I don't see what makes it wrong?
 
comes from here
 
see link
 
I think typename is forbidden when not needed.
In that case, it's not needed.
 
10:51 AM
but S has only a specialization on double; is that not what causes it to be malformed?
 
Yes.
But no SFINAE if it's not in a template context and it involves template parameter.
 
3 mins ago, by Tony The Tiger
comes from here
see the link for where it came from
 
If it's not a dependent name (i.e. doesn't depend on a template parameter), there's no substitution to be done, and therefore no SFINAE. It's just a good old error.
 
@TonyTheTiger I was referring to your previous message.
 
anyways, I have to go
 
10:53 AM
4 mins ago, by Tony The Tiger
void f(const char*, typename S<const char*>::type* = 0) supposedely this is not well formed and would be ignored through SFINAE, but I don't see what makes it wrong?
 
You wouldn't want void f(std::vector<int>::blah_blah_blah x); to compile.
 
@LucDanton that came from the article in the link I posted
 
Is there ever really a reason to use anything except enable_if and a <type_traits> library?
 
The linked article has template <typename T> void f(T, typename S<T>::type* = 0); which does have a dependent name.
In that case SFINAE kicks in.
 
is there a pre c++0x way to bind to the second member of a pair without using boost::bind?
 
10:55 AM
@Potatoswatter Conversion operators :)
 
@awoodland There's bind2nd and make_pair… good luck :P
 
you can't use bind2nd for that can you?
 
Also tr1::bind is on most moderately recent C++03 compilers, that's not C++11 but works almost identically.
 
> Though, I've heard that overriding methods is bad OOP design.
 
If by bind to the second member of a pair you mean create a unary function which assigns to the first member…
If on the other hand you mean create a unary function which returns the second member, then just code it yourself.
 
11:00 AM
I had a fuzzy memory that the last time I wrote "take_first" and "take_second" they already existed in a different guise
not that they're particularly hard to implement, but still
 
Nope, they're definitely missing from C++03.
In C++11 it's std::get<0> and std::get<1>.
So if you want to write your utility "the right way" for forward compatibility…
 
Isn't std::get part of TR1?
 
std::array is… lemme check…
Yep. TR1 §6.1.4
Curiously it's defined to return second for any nonzero index. Still so on C++11?
 
No, ill-formed.
 
Nope, fixed.
 
11:06 AM
> If I == 0 returns p.first; if I == 1 returns p.second; otherwise the program is ill-formed.
 
11:27 AM
> If function calls are involved, the expression a() && (b() && c()) is not equivalent with (a() && b()) && c() because of the reasons expressed in the previous posts.
He still doesn't get it :(
 
11:56 AM
@AlfPSteinbach What is that postmoderninsm generator thing? I don't know about it, link me up
 
Lunch time!
 
12:27 PM
oh hai
 
12:45 PM
http://t.co/dSJ8Zbf C++ room motto: "why would anyone want to have sex instead of being here?"
7
Prepare for shitstorm of C++ fetishists ;)
 
My short self-contained witty comment is now Teh Famous™
 
i just SIGFAULT'd all over my NULL pointer
 
We're famous.
 
it's SEGFAULT
I'm pretty sure
 
Or SIGSEGV
BTW, What does the V stands for ?
 
12:48 PM
no idea
I think that Access Violation is a way better name anyway
since there is effectively no segmentation anymore for usermode code on x86
 
Rape is a better name
 
how do I get 20?
 
Test
 
Yep. Legacy. That's what UNIX and friends is all about.
@cskilbeck What ?
 
sorry, please ignore
 
12:51 PM
meh
 
@kbok I thought legacy was all that MS was about
 
maintaining legacy code is a strong desire in all systems
 
@hexa Thought they're fond of backwards compatibility for business purposes, they don't keep 40-year-old API or terminology just because "That was the good ol' times"
 
@kbok What API are you bitching about?
 
@hexa The C library for example.
Or, less old, but way more crappy, the X Windows System.
 
12:57 PM
Win32 is no spring child itself
 
And I'm not speaking about the all-file principle. Ever used the /sys API ?
 
A random question from a non C++ guy: How many of you still use raw pointers in your code?
 
uh
pretty much never, really
 
@missingfaktor Only when extremely necessary.
 
for legacy libraries
 
12:58 PM
smart pointers hold all the resource management keys
and strong references work well except when you need to start storing them in objects
 
I use raw pointers because Qt uses them.
 
so raw pointers are only used for non-owning rebindable aliases
or to support legacy code...
 
Uh, we know about that.
 
if you're trying to interop with the C file API, you can't not use a FILE*
 
12:59 PM
does anybory read this site
 

« first day (314 days earlier)      last day (4636 days later) »