« first day (506 days earlier)      last day (4425 days later) » 

3:03 PM
Oh, found a clang bug.
@Xeo do you mind testing this on your build? (I'm sure it's up-to-dater than mine)
(paste coming up)
 
Xeo
Nah, I didn't build clang for a while
 
“C++: the plus signs are actually arrows. They only look like plusses because they're POINTED DIRECTLY AT YOUR EYEBALLS.”
 
:( haters gona hate
 
I haven't checked, but I'm pretty sure the standard lets me use typedefs for underlying types.
 
3:07 PM
stackoverflow.com/questions/9565003/… this question... again :P Can I get my edit accepted please
 
Xeo
@RMartinhoFernandes Does it crash or does it say "not allowed"?
 
It fails overload resolution.
> candidate function not viable: no known conversion from 'typename std::underlying_type<foo>::type' (aka 'unsigned int') to 'unsigned int' for 1st argument
 
Xeo
lol
 
"No known conversion from unsigned int to unsigned int" is clearly bollocks.
 
@RMartinhoFernandes o_0 something is broken :P
 
3:12 PM
you guys are always talking about C++
damn you all :P
 
@TonyTheLion When we don't, people complain.
When we do, people complain.
 
Xeo
robot, full error?
 
people like to complain
 
@Xeo It's pretty much just that really.
test.cpp:15:5: fatal error: no matching function for call to 'f'
    f(to_underlying(foo::bar));
    ^
test.cpp:12:6: note: candidate function not viable: no known conversion from 'typename std::underlying_type<foo>::type' (aka 'unsigned int') to 'unsigned int'
      for 1st argument;
void f(unsigned) {}
     ^
 
Some people see a problem and think "I know, I'll use Java!" Now they have a ProblemFactory.
 
3:14 PM
@sehe NIIIIICE
 
@RMartinhoFernandes lol, I was being silly. I don't mind what you talk about
 
Xeo
@sehe AbstractProblemFactory
 
@RMartinhoFernandes DF++
 
pron would be the best though :P
 
@Xeo Or, in MS VS API, ProblemFactoryProvider
 
3:14 PM
oh sure, when @Sehe posts something donkeys old, Nice, when I did, 'repost'
(╯°□°)╯︵ ┻━┻
 
Xeo
hrhr
 
@sehe Repost!
 
REPOST ALL THE THINGS
the internetz is basically a bunch of reposts of life
 
Xeo
Robot, does the second call to f work?
 
3:16 PM
^^ > Did you know that there are FactoryFactorys all over the place in the VS API? Someone seems to have known that was bad, so they renamed them FactoryProviders
@TonyTheLion Hey, I'm only following up on your suggested reading link (ProgrammerHumor)
 
@sehe The guy that wrote that needs...
 
Repost more!
 
@Xeo Oh, damn, I'm compiling with fatal errors. But no, neither does.
 
Xeo
heh
Makes the testcase smaller
 
FactoryProdivdorSingleton???
 
3:18 PM
Yeah. My problem arose with the to_underlying function, and I tried the static_cast inline to test if there was other some interaction going on.
 
@Xeo that's what she said!
 
@sehe oh lol
 
If I turn fatal errors off, it also says:
> error: static_cast from 'foo' to 'std::underlying_type<foo>::type' (aka 'unsigned int') is not allowed
Which again, is clearly bollocks.
 
Xeo
$ clang -v?
 
That makes no difference in the errors.
 
Xeo
3:20 PM
I want to know the revision :P
 
Ahh so confused :P
 
Oh. That's not in there. I need to dig into the package script again to see what's wrong.
 
Xeo
huh?
 
"clang version 3.1 (trunk)" is not useful.
 
Xeo
clang -v should print the revision
Okay, that's rather strange
 
3:21 PM
I build with cmake, I guess there's something missing.
Luckily, the package manager tracks that: it's 151586.
 
Xeo
Ok, #llvm's clang-bot is r151970
And it just asserts there
 
Anyone got any idea why a simple hello world C++ program wouldn't (when compiled on a Arch system) run on Ubuntu, but when compiled on Ubuntu (same makefile) would run on the Arch?

The error being (on Arch -> Ubuntu) that "cannot execute binary file"
 
Xeo
Wait, I didn't provide an f
 
@Xeo I'll try updating then.
 
Xeo
Which is even stranger
but lemme test again
 
3:23 PM
@Xeo Oh, that's important.
 
Both are x86 :|
 
Or maybe not. I think it errors out without the overload.
 
Xeo
still asserts
 
By "assert" you mean ICE?
 
Xeo
Yes
 
3:24 PM
Ah, so it went from diagnostic to ICE. Ok, not updating yet :)
 
Xeo
Okay, you don't even need the cast
underlying_type is completely broken it seems
for typedef types
 
Yeah. It works fine if I spell out the underlying type.
 
Xeo
This triggers the assert on clang-bot atleast
So even if a typedef-name was not allowed as the underlying type (which would be strange anyways), it's clearly a bug
 
Compiles fine here.
 
Xeo
Update :P
 
3:27 PM
No!
@Xeo If it weren't allowed you wouldn't be allowed to write enum class some_twenty_flags : std::uint_least32_t;, which is darn useful.
 
@thecoshman Java programmer will not abbreviate or tolerate typos. Checking in a typo is ground for immediate dismissal.
 
@RMartinhoFernandes what do you mean "VC11 already ships it"
 
@sehe Just because you're not familiar with the Prodivdor pattern, you shouldn't dismiss it.
@CheersandhthAlf VC11 ships <filesystem>, which AFAIK is the TR2 filesystem proposal.
 
@RMartinhoFernandes I think it's much premature to standardize, considering that it relies on non-standard VC extensions and Does Not Work where those extensions are not present, such as when compiled with MinGW g++.
 
@sehe I'm not a Java programmer. I am a C++ programmer held hostage
 
3:31 PM
@RMartinhoFernandes Yes I should. Only the blessed patterns are to be used. If a getter/setter doesn't start with 'get' or 'set' it is wrong. If you can't think of a good pattern/a good name (like Provivdor) just use Singleton instead
 
OTOH., the new trend in programming seems to be adopting the standards of web designers, that whatever works in their browser on their machine, is good enough.
 
@CheersandhthAlf Oh, I don't know. My point was that the proposal was mature enough to be accepted into the TR2 and to be shipped in VC11.
 
@CheersandhthAlf truth
 
@RMartinhoFernandes it is not mature enough, and it is pretty shocking that they're saying that (if they are). it does not work for Windows filenames (without extensions to the standard). yet.
 
@CheersandhthAlf Oh, so MS changed it to ship in VC11?
@sehe That's actually a good point.
 
3:33 PM
@RMartinhoFernandes no, they're probably just using Boost filesystem as-is. I haven't look at it. But the Boost implementation uses MSVC extensions, in particular wchar_t constructors for std::ofstream & friends -- and it Does Not Work with g++.
it sounds like a political process, but hey, that's nothing new :-(
 
Xeo
@RMartinhoFernandes, can you try compiling the snippet with -stdlib=libstdc++?
 
@CheersandhthAlf So, standard std::ofstream is broken on Windows? Ow.
 
Xeo
(assuming you use libc++ normally)
 
@Xeo Sure. But I've looked at the implementations and they're both the same.
 
@RMartinhoFernandes no the MSVS ofstream is usable. It's the strict std::ofstream that is broken
due to unicode path handling in Windows.
 
Xeo
3:37 PM
Wasn't that fixed in C++11? (i|o)fstream got their wchar_t const* ctors, didn't they?
 
>_<
 
@RMartinhoFernandes Almost. There was and is a workaround, namely to use DOS 8.3 filenames, which Windows does support as aliases for the long ones. One problem is that they're generally unreadable, and another problem is that this Windows functionality could be turned off by the user in Windows Vista and earlier. It was the workaround used in Boost filesystem v2. It was removed in v3.
 
Realised my problem hehe, was trying to run a 64bit binary on 32bit system... fail...
 
another workaround is your mother!
 
@rubenvb Yes, that's what I meant by "standard std::ofstream" :)
@Xeo No, they got std::string ctors.
Now I lost my testcase.
mving when you want to cp is bad.
 
Xeo
3:39 PM
?
lol
 
Luckily, I posted it on ideone first.
 
strange though, most x64 systems these says can still run x86 code
 
Yeah
It worked when compiled on the 32bit system
 
@thecoshman "run 64bit binary on 32bit system" <- other way around.
 
Exactly as Martinho said
 
3:40 PM
@RMartinhoFernandes clearly I need to head home
 
Xeo
@RMartinhoFernandes That's bad.
 
Haha
 
Xeo
> [16:36:34] <pcc> Xeo: fixing
@RMartinhoFernandes ^^
 
Xeo
Damn. When the sun is out, it's dazzling me and makes my screen harder to see. If it's not out, it's cold in my room. :(
 
3:43 PM
You sound like a dorf that spent too much time underground.
 
Xeo
Nah, it's just really shining straight in my eyes from the window
 
Alright.
 
Xeo
Thats what trees are for
Or blinds
Or heaters.
Or ATI cards :D
 
Or stop bitchings.
 
Xeo
Good idea, I'll plant a tree right on the road in front of our house!
 
3:45 PM
@Xeo the perfect solution
 
Xeo
@RMartinhoFernandes Bitching? Aw c'mon, I only wrote two messages about it :s
 
We have many of these things here in Portugal. We should make a tourist attraction out of it.
 
Xeo
@RMartinhoFernandes lol'd
 
@Xeo, just do F@H, should keep your room warm enough :). All problems solved.
 
What's F@H?
 
Xeo
3:48 PM
F@H?
 
Folding @ Home
 
Oh. I thought the F stood for something else.
 
Its a distributed computing project, keeps your CPU & GPU at 100% for those cold winter days
 
Xeo
@RMartinhoFernandes is @Tony infecting you or something?
@Daniel Or for keeping your pizza warm.
 
@Xeo "Fun". I thought it stood for "Fun".
 
Xeo
3:50 PM
Yeah, "fun"
 
@Xeo you mean cooking your pizza
 
@Daniel I use DF for the CPU part.
 
@RMartinhoFernandes DF?
 
It's not like my GPU has a lot of power anyway.
 
@Xeo wut?
 
3:55 PM
@RMartinhoFernandes You're even sicker than I thought :p
 
@RMartinhoFernandes Oh, I wanted to tell you the tale of how my optional implementation exhibited weird bugs. Would you take a guess at what I did wrong?
 
std::aligned_storage<blah> // no ::type? Can I at least get a hint of what the bugs were?
 
optional<int> and optional<std::unique_ptr<int>> all worked fine, but problems appeared with a type with a layout similar to std::pair<std::unique_ptr<foo>, std::unique_ptr<bar>>: segfault on destruction or when calling reset (the optional member, not the pointer member).
And I did get the typename ::type right.
 
Hmm, no, I can't guess it.
 
obviously you attempted to destroy the wrong type?
 
4:01 PM
typename std::aligned_storage<std::alignment_of<T>::value>::type
 
oh dear
 
To cut the story short now I have a StorageFor alias because fuck that.
 
C++ syntax is lovely sometimes :P
 
Btw, why alignment_of and not alignof?
 
4:02 PM
I have no idea if the latter is implemented tbh.
 
Is there a non-stylistic argument to make that choice?
@LucDanton It is. Only alignas isn't. (I have a near-complete emulation on GCC, btw :)
 
Well I use metafunctions a lot so I didn't really give a lot of thought to it.
There's a nice symmetry in typename std::aligned_storage<sizeof(T), alignof(T)>::type though.
 
Xeo
@Luc, I think it would help to show the implementation of your optional type
 
@Xeo wot
 
Xeo
Oh, wait, that aligned_storage thingy above was the problem?
 
4:06 PM
@Xeo Obviously. First argument is size, not alignment.
 
Xeo
Yeah, I just noticed that. What is the second argument defaulted to anyways?
 
The smallest alignment for an object of the given type.
 
Xeo
> [17:07:08] <pcc> Xeo: r152031
@RMartinhoFernandes ^^
 
@Xeo A value such that the storage is aligned for any type of the specified size or less.
Very handy for implementing operator new I suppose.
 
Xeo
4:09 PM
Wouldn't it suffice to only have the size argument then?
 
@Xeo typename std::aligned_storage<sizeof(char[100])>::type gets you way too much alignment for a character array.
 
Xeo
Good point
 
And it can be used for extended alignments. typename std::aligned_storage<sizeof(some_sse_type), 16 /* or whatever extra alignment is required */>::type
 
Hence why a StorageFor alias is handy as std::aligned_storage is a metafunction that can compute quite a lot of things.
 
Xeo
You really like that CamelCase for type traits, huh?
 
4:11 PM
Plus I get it wrong anyway.
 
@LucDanton Yeah, most of the time you really just want typename std::aligned_storage<sizeof(T), alignof(T)>::type
 
@Xeo Aliases.
I have aliases to metafunctions and to traits.
 
Aliases to traits?
Like IsConst?
template <typename T> using IsConst = std::is_const<T>;?
 
RemoveReferefence is a trait in Standard parlance.
Well, std::remove_reference is.
 
Nevermind.
 
4:13 PM
meta::Rebind however is nothing like a trait in all the meanings.
@RMartinhoFernandes I don't disagree with that tbh.
 
@LucDanton The only reason it's not a trait is because it doesn't have a ::type nested type.
That's pretty much what makes a transformation trait in standardese.
 
Xeo
std::is_pointer<T>::type :P
 
> A TransformationTrait modifies a property of a type.
There's more to it than ::type. And there's an underlying metafunction between the alias anyway since I need partial spec and this has a type member. Still not a trait.
 
Xeo
That's kinda misleading, as it doesn't modify the type itself
 
What's misleading?
 
Xeo
4:16 PM
> modifies a property of a type.
 
It modifies the property, not the type! Everything's fine!
@RMartinhoFernandes So meta::Rebind is not a trait by all measures of the Standard.
 
Aren't the template arguments of a specialization a property of the type?
 
Sorry what?
 
I'm baaaaaaaack.
 
A stumbling block is that all three definitions of a traits in the Standard mention that a trait operates on types, which is not the case for meta::rebind (underlying metafunction of meta::Rebind).
 
4:20 PM
@CatPlusPlus You are caaaaaaaat.
 
@LucDanton Ok, what is rebind?
 
@RMartinhoFernandes Rebind<std::common_type, std::tuple<int, long, double>> is std::common_type<int, long, double>.
 
Oh.
Ok, then, I drop my argument, as it was based on a false assumption.
Works on 4.7: ideone.com/EbW11. I don't think I can make multiple alignas work though.
 
I'd argue that identity is not a type trait either, it's not a query nor does it change anything, much less a property of its argument. Ditto void_.
So yeah I do have aliases for both traits and metafunctions.
 
Wild Lisp appears!
 
4:23 PM
What?
 
())))))
 
Xeo
@LucDanton I'd rather call that unpack, as I had the same assumption as the robot, namely that rebind changes the template parameters of an already provided template specialization
 
Router playing tricks again?
 
Xeo
yes.
 
4:25 PM
The justification for the name is based on the rebind member of allocators if you were wondering.
 
Xeo
Yeah, but that thing actually "changes" a template argument. Yours just unpacks the tuple into a template
 
@Xeo What's the difference? Rebind<std::tuple<>, std::pair<int, long>> instead of Rebind<std::tuple, std::pair<int, long>>?
I mean I don't understand what your version is atm.
 
Xeo
Err... I was just stating why I think the robot (and I) misunderstood you :P
 
using foo = std::vector<int>;
static_assert(std::is_same<Rebind<foo, double>, std::vector<double>>::value, "this is what I was thinking");
 
Xeo
rebind implies something other than unpacking, imo.
Exactly
 
4:28 PM
That's a bad assertion message. It's more of a comment.
 
because Lambda Calculus
 
That's a rubbish functionality.
 
Probably.
But that's what "rebind" invoked in my mind.
@TonyTheLion What?
 
Xeo
Why? It's a bit like mpl::transform<foo, returns_double<mpl::_>>
Oh, wait, that would probably replace the allocator with double
 
@Xeo Because his version only ever affects the first template parameter.
There's no generality.
 
4:31 PM
@LucDanton Oh, that was just for not thinking too much about it :) What matters is that the first argument is a type.
 
Well as I pointed out it's possible to make the syntax Rebind<std::tuple<>, std::pair<int, long>>. That's a bikeshedding issue.
As it doesn't describe a relation between the two types it's not a trait according to the Standard either though.
 
@RMartinhoFernandes just being random
 
Well, no.
The int in std::tuple<int> is not a property of std::tuple<double>.
Oh well I still understand what you mean despite the phrasing.
 
:S
I meant whether the int in std::tuple<int> is a property of std::tuple<int> or not.
I think so, but I'm trying to stretch the definition to win the argument. :P
 
4:35 PM
It can be, but once you change to std::tuple<double> it's a completely unrelated type with unrelated properties. Or it'd be, if I didn't pick a template that users can specialize.
(Perhaps it's okay to specialize std::tuple if one type is user-defined. That's neither here nor here though.)
Even if the syntax accepts a type I still take it as a metafunction that operates on templates, not types.
 
4:47 PM
Ok, rebuilding clang. If this is brokener than before, I'm blaming you, @Xeo.
 
so why have I seen so many discussions here that involve std::tuple ?
what's so special about it?
 
It's the poor man's compile-time functional list.
 
C++11, also formerly known as C++0x, is the name of the most recent iteration of the C++ programming language, approved by ISO as of 12 August 2011, replacing C++03. The name is derived from the tradition of naming language versions by the date of the specification's publication. C++11 includes several additions to the core language and extends the C++ standard library, incorporating most of the C++ Technical Report 1 (TR1) libraries — with the exception of the library of mathematical special functions. C++11 was published as ISO/IEC 14882:2011 in September 2011 and is available for a fee....
 
Xeo
@RMartinhoFernandes Unless you only made symlinks for your $PATH, or added Release+Asserts/bin to it, you can just skip the make install and test first
 
^ The link goes to section 7.3 about tuples
 
4:53 PM
@LucDanton ah
 
@Xeo I can use the package manager to revert.
 
that means you can create a tuple to use with TMP?
 
That's an abuse of std::tuple really. Especially when you consider e.g. std::tuple<void>.
 
Xeo
@LucDanton Yeah, but that doesn't work for types which don't allow empty template argument lists
 
@LucDanton Is that allowed?
 
4:56 PM
hi all
 
@Xeo So what? Do Rebind<std::vector<int, foo_allocator>, std::pair<double, bar_allocator>> obviously, not Rebind<std::vector<>, ...>...
@RMartinhoFernandes I suppose it is, although I haven't checked. My reasoning being that there's no instantiation, i.e. consider if I had template<typename.... T> struct list;, then I could still attempt e.g. std::is_same<list<foo, bar>, int>::value.
 
@TonyTheLion it means std::tuple is like a bridge to variable number of arguments, and type lists. but i haven't used at all. can't say anything about the details.
 
Xeo
@LucDanton The paragraph on tuple atleast doesn't mention anything on void
 
@Xeo Yes, the problems are with members. So to use std::tuple<void> safely you have to keep track of what usage means instantiating what members and so on, which I think is a bit silly considering (re)inventing a list isn't too much work.
But I suppose laziness is a virtue and I really like the challenge of not resorting to Boost.MPL. A great way to check what C++11 brings to TMP.
 
Xeo
It brings variadic templates, and that alone is already a great relieve for TMP
 
5:10 PM
You do need machinery to make the packs usable more often than not, which what that Rebind is part of.
 
5:23 PM
@LucDanton D's variadics are much better in that respect. There packs are first class meta-citizens.
 
@RMartinhoFernandes Unrelated but are you not going to ever use std::result_of again?
 
@LucDanton Dunno. I got a bit scarred.
 
I don't understand how it's supposed to be used if the Functor part of the signature has to be callable.
 
"I wonder why I didn't think about this sooner!!!" Perhaps because it's silly?
 
5:30 PM
still, using a static Main in a class looks cool!
 
FTR std::vector<std::string> v(argv, argv + argc); is more concise.
 
Interesting, I wrote this test for this question. Baseline time when compiled with VC++ is ~6 seconds. Baseline time when compiled with GCC is ~21 seconds. Same computer/OS/everything, just different compiler. Since when is GCC four times slower than VC++?
also, my output makes no sense. Maybe I'll run the baseline twice. Nope, no difference.
 
> Because I need some custom functionality such as tokenizing, some custom kinds of conversions and manipulation, ... and also I need it to work for ALL languages, that's why I made it template. :-) - ai64 8 secs ago
 
What's a good behaviour for apply(f, option) if the return type of f is void? Return bool? Specialise optional<void> to have a consistent interface?
 
I wouldn't specialize optional<void>.
Why would you want a bool?
 
5:46 PM
And forget about making for(auto&& result: apply(f, option)) { ... work in generic code? That seems worthwhile.
@RMartinhoFernandes Isn't going from optional<void> to void a loss in information? bool preserves that information, doesn't it?
 
Yes, but that information is still on option.
Oh, wait, f could mutate it.
Damn.
 
Notice how if(auto&& result = apply(f, option)) { still 'works' with bool, until you have *result anyway.
 
@LucDanton Did I ever mention that I'm still on the fence about abusing range-based for like that?
 
@RMartinhoFernandes Yes.
I'm going to try it for a while and see what happens.
There's the very real possibility that I never use it.
 
Though optional is sometimes called a container, so you could argue that's not really an abuse...
@LucDanton So optional<void>::operator* would return a bool?
 
5:51 PM
@RMartinhoFernandes I haven't thought this far. I think I'm going to let the idea simmer for a while and get back to it at some other time.
The precedent I was thinking of is std::future<void> but its get member still make sense when returning void.
 
What makes me stay away from optional<void> is the fact that void is not truly a unit type (it's type 0, not type 1).
So operator* gets weird.
 
@RMartinhoFernandes I know the feeling.
 
Damn. Offline for maintenance in the middle of the day?
 
At first I thought an optional<void> with only interface being the conversion to bool would be workable but I'm not so sure. Means more work for the 'iterator', too. So again, I'll think about it for a while.
operator* returning *this?
 
I've discovered my tests take the same total time no matter how many times I run them with GCC. If my GCC parameters are "*.cpp -Wall -std=gnu++0x -pedantic -Wextra -O2 -Weffc++ -o$(TargetDir)gcc$(TargetName)$(TargetExt)", will it do a full rebuild every time?
 
5:57 PM
Well, for(auto&& result : apply(f, option)) won't enter the loop body if option is empty. But if it does have a value, result needs to be something. If it were a bool as I thought above, it would always be true. For other types, whatever its value is, it's going to be worthless, just like a unit type. So, what would cause the least trouble?
 
@MooingDuck Yes.
 
@LucDanton I am so confused
 
@MooingDuck I'm sorry.
 
does anyone know why this code doesn't compile? ideone.com/zxCzh
 
@PaulManta That reminds me, I need to finish writing that answer.
 
5:59 PM
@PaulManta getline can't deduce the template types required to make it compile. It doesn't realize you want a conversion.
 
@RMartinhoFernandes I appreciate your insights. However if I'm not saying anything it's because I'm letting all those ideas sink in, so don't let that stop you from thinking out loud.
Well unless that question was not rhetorical and you really want my input.
 
Xeo
@MooingDuck It doesn't allow a user-defined conversion
 

« first day (506 days earlier)      last day (4425 days later) »