« first day (1464 days earlier)      last day (3478 days later) » 

6:00 AM
\\| vs ||
 
oh right
scrap that
alternatively perhaps automatic indexing can be done |.|
but I still like {} better
 
I don't like automatic indexing (it's possible, but I don't really like it).
 
or |_|, whatever
 
I'd have to disallow positional if you switch to automatic :s
 
you don't
 
6:01 AM
that's how it gets confusing :)
 
how I did it was idx = -1 initially
{} means {++idx}
{5} means {idx = 5}
 
yeah I know how it can be implemented
 
alternatively you can disallow it
I prefer that in dynamic languages
 
meh
 
but in compiled languages I'd rather have a compile-time error message (constexpr arguments anyone?) or just work
 
6:02 AM
@LucDanton Outside of std::isdigit, where do I use the locale?
out <<?
 
@Rapptz Keep in mind that it’s not so much about locales per se as it is programmer expectations.
 
anyway
I'd love to discuss this later
 
@nightcracker Please no.
 
but now it's league of legends world championship final time
 
You’ve brought nothing of value.
 
6:05 AM
@LucDanton that'd be rather impressive to bring something of value in 15 minutes to something you guys discussed for god knows how long
 
days!
 
@LucDanton but thank you for being so kind to point it out
/s
 
You’ve been dismissive and inconsiderate the whole time, e.g. by suggesting others are somehow ignorant of how parsing or other languages work. I’d rather not relive this.
 
well forgive me for being blunt at times, that's who I am, but I don't recall suggesting other people's ignorance or being dismissive
 
I assume you don’t realise it, or you wouldn’t have done it at the time.
 
6:09 AM
I feel dumb :(
I can't see where the format string depends on a locale.
 
@Rapptz As you have it now, or as you should specify it?
 
@LucDanton mind pointing it out explicitly? I'm not unwilling to learn as my social skills could use improvement
 
As I have it now.
 
18 mins ago, by nightcracker
can you give one realistic example where { or } is your fill character?
That really didn’t need the ‘realistic’.
 
I don't understand? With realistic I meant to rule out the obvious trivial example, asking for a real-world example instead
 
6:14 AM
@Rapptz Should |२५| be a valid specifier that fetches the 24th argument?
@nightcracker Nobody but you can know what that means ahead of time. Why do you need to dismiss all the other situations anyway, whatever they are?
I’d gladly take part in a discussion, but I don’t want to spoon-feed anyone.
 
@LucDanton I'm not dismissing all other situations, just the trivial example that is "because I can"
 
@LucDanton Ah so it was std::isdigit.
 
@Rapptz not necessarily
 
?
 
@Rapptz '9' - '0' is not guaranteed to be 9
 
6:16 AM
welp
 
I remember discussing it here before.
A long long time ago.
16
A: Are the character digits ['0'..'9'] required to have contiguous numeric values?

phresnelIndeed not looked hard enough: In 2.3. Character sets, item 3: In both the source and execution basic character sets, the value of each character after 0 in the above list of decimal digits shall be one greater than the value of the previous. And this is above list of decimal digits: 0 1...

 
TIL I was wrong
 
@Rapptz I think that’s the only place, yes.
Rest is only Trait::eq AFAICT.
 
I did not know C++ included this requirement
 
Yeah that's std::char_trait though, not the locale
 
6:22 AM
I meant how you parse/consume the string. E.g. you don’t use isupper or the like.
 
Well yeah :p
There's no need for those.
 
You could update the grammar at any time!
 
I originally had x and X be different
 
@Rapptz More pressing than just forwarding the arguments though, why do you copy them at all?
 
So x is std::hex, and X is std::hex and std::uppercase but then I decided that gets complicated quickly.
 
6:23 AM
See :Þ
 
Where do I copy them?
You mean std::make_tuple and its special decay?
 
Which also performs regular decay, yes.
 
Hm..
I just realised my 'laziness' is unwarranted here.
I could just do std::tuple<Args...>
Also, on a somewhat unrelated note.
I could get out.widen to work but out.narrow would never work for me.
time to get hacky.
 
@Rapptz Meaning what?
 
It'd always return the 'default' character.
out.narrow(*str, 0x00); // would always return 0x00 for me
 
6:29 AM
lol
What was the wide character type?
 
it was just a regular char of T, U, etc.
Maybe it doesn't allow char <-> char conversions.
> char narrow( char_type c, char dfault ) const;
Oh that's a fancy way of getting around default being a keyword.
 
@Rapptz I don’t understand.
 
out.narrow('T', 0x00); // returns 0x00
 
works fine here with the global locale
 
Hm :(
 
6:33 AM
oo
@Rapptz Which system?
 
Might be a MinGW thing then.
 
Can you try std::locale::global(std::locale { "C" }); in main?
 
isn't proper string handling in C++ amazing? /s
 
despite the sarcasm
std::char_traits is neato
@LucDanton Oh it works fine.
Kind of weird.
It wasn't working yesterday.
@LucDanton I now realise why I did this.
error: array used as initializer
 
doesn’t ring a bell
 
6:43 AM
maybe std::tuple<const Args&...>?
hm yeah that works
well I took into consideration your criticisms and updated the code :D
You can now witness this greatness:
    //             checks if a character is a digit
    while(*str && (*str >= zero && *str <= zero + 9))
 
@Rapptz I forgot to mention it earlier, but that kind of stuff is non-deducible of course.
 
:<
how?
 
foo<TypeParams> is never deducible. I should say ‘not fully deducible’ though, but I didn’t make up the term.
If you still wanted variadic arguments, tupling without copying is auto tuple = std::tie(args...);.
 
How would tuple<const Args&...> cause issue?
 
Something convertible to a tuple won’t be accepted.
Whether that is an issue or not for you I can’t tell.
 
6:56 AM
how is that any different with std::tie?
 
Args const& always works.
The more salient point is whether you want an interface taking a tuple or a pack though.
 
I'm just abusing tuples tbh
 
It’s not abusive…
 
in my ideal world I could do arguments[0] or whatever
yeah probably
it feels abusive to me because of how many work-arounds I had to do.
 
For me, it would have been Tuesday :s
 
6:59 AM
well we do work-arounds all the time eh :)
 
I actually don’t have a refactored helper to index into a tuple, even though I do it in two or three places.
 
I like the implementation I have there.
It feels clean to me for what it is.
I'm open to other names rather than apply though
print("stuff", std::ignore); // heh
 
I have cotuple but it’s a joke we did with @Xeo hah.
 
well
I'm content with this for now.
 
@Rapptz Tuples instead of packs as the advantage that for a caller it is easier to turn a pack into a tuple than the other way around.
 
7:06 AM
I feel like passing in a tuple is a lot more typing for the end-user.
it's not hard for me to just turn the pack into a tuple anyway
 
…until we can do [&]<int... Indices>(indices<Indices...>) { … }(indices_for<Tuple>()) of course :)
 
but fold expressions and std::apply!
I feel like std::apply could have gone to something better.
The name's too clever and neat to go to tuples.
 
std::tie(args...).accept_visitor([&] { … })
 
yeah..
maybe a member function would have suited it better
 
I was trying to pitch as bad an idea as possible actually.
 
7:11 AM
I was thinking more std::tuple_visitor as a free function name rather than std::apply
maybe I could pitch this in
before it's too late
 
I actually can’t remember what mine is called…
Oh, right. uncurry.
 
it'd be a shame if the great std::apply name is taken :v
lol clever
 
Seeing as in C++ you can have a functor taking (std::tuple<X, Y>), (X, Y) or (X) // returns Invokable<void, Y> though it may not be the best choice :)
 
I kinda miss being on Linux
Weird sensation
anyway time to commit this shit over
and then document it
 
I tried to tuples::map last week, and it turned out I don’t have such a function. That was confusing.
 
7:15 AM
what would that do?
std::tuple<Args1...> -> std::tuple<Args2...>?
 
Yes.
 
I actually have that lol
 
I do, but it’s tuples::transform (with the arguments flipped of course). I must have thought that one variant is enough, and I might as well pick the idiomatic one.
 
Ah the good ol' map vs transform :p
I prefer map 10/10 times.
 
Substitute result_t<F, A...> with result_of::invoke<F, A...>?
 
7:20 AM
the revolution against _t?
 
My first reflex was to say that I’m keeping _t, but I’m not sure that would be honest—maybe I am re-emphasising result_of as an unconscious reaction, hah!
 
Where would I keep my tuple related things?
gears/tuple?
 
At first I thought they should belong alongside e.g. variants and optional values, but they’re just too useful. So they do have their dedicated tuple/.
 
Hm..
tuple::visitor vs tuple::tuple_visitor :p
 
Picking ‘visitor’ was part of my plan of making the suggestion as ridiculous as possible.
 
7:27 AM
rude
:<
 
I don’t feel as strongly about just ‘visit’ bizarrely enough :Þ
 
I'm okay with tuple::apply because it's subnamespace'd
 
I use apply for applicative functor stuff, which is zipping for tuples.
 
7:48 AM
good morning
 
Well, it's morning, anyway. I have an issue with 'good':(
For me, it's a coffee/paracetamol day.
 
8:05 AM
@MartinJames too much booze last night?
 
@TemplateRex Beer festival...
 
was it a festival about beer or was it a lot of beer for a random festival?
 
Are standard libraries like stdio, stdlib in C++ statically linked or dynamically linked?
I went through a few links on the main site. I think I now understand the difference between static linking vs dynamic linking but I am not sure how the standard libraries are linked? Sorry for being naive.
 
Typically, either option is available.
 
8:20 AM
For instance, I write a small program and compile it with gcc myprogram.cpp. I use header files cstdio, cstring for my program. Where is the linking part? How did the OS manage it?
and I run it like ./a.out
 
In the case of GCC, g++ source.cpp is shorthand for g++ -c source.cpp -o source.o; g++ source.o. The linking happens in the second command—by linking here it is meant a call of the system linker to produce a full executable binary.
(Using gcc for compiling C++ programs is tricky.)
 
Sorry, I meant g++
 
Perhaps you could try linking to a small example library yourself? It’s the same process as with the standard and system libraries.
 
@chmod711telkitty Not sure. I'll have to goto the club again at lunchtime and ask:)
 
Alternatively, you could try something like g++ -v …rest of command…. Turning on the verbosity shows what otherwise happens under the covers.
 
8:26 AM
Awesome! Thanks for the pointers. I'll try it with the verbosity now.
 
Look for -l and -Wl flags.
 
Ok! so I see stuff that looks like this -L/usr/lib/gcc/x86_64-linux-gnu/4.8 and -dynamic-linker /lib64/ld-linux-x86-64.so.2
So, looks like it is statically linked since I am seeing this on compile time. Is my understanding correct?
 
That’s not it.
Even if the library executable will be provided at the time the program is run (as is the case for dynamic linking), the linker needs the library executable at link-time as well. So you will see those libraries appear on the linker invocation.
I encourage you to write a simple library and a simple executable that uses it. Try linking statically and dynamically. That should familiarise you with the process and tools.
 
8:44 AM
@LucDanton Thanks. Will do.
 
user1804599
 
9:05 AM
@rightføld funny, but probably not real
Has it not bothered anyone that despite the STL being "object-oriented", .find() is still not a member function of std::vector, as you'd expect it should be? I wonder if this is somehow a consequence of templating. — bobobobo Dec 7 '12 at 2:33
lol
130
Q: Why is the C++ STL is so heavily based on templates? (and not on *interfaces*)

OB OBI mean, aside from its obligating name (the Standard Template Library)... C++ initially intended to present OOP concepts into C. That is: you could tell what a specific entity could and couldn't do (regardless of how it does it) based on its class and class hierarchy. Some compositions of abilit...

 
I was looking for ghost on train but found this instead ...
 
@chmod711telkitty aawww...
 
couldn't but ask the question "but how?"
 
Ell
9:22 AM
does anyone know if there is a ready made key iterator? (For iterating over just keys in std::map)
 
There's one in Boost but that's overkill :p
for(auto&& p : map) { const auto& key = p.first; /* use key here */ }
 
In objective C, you could do this (dictionary is similar to map)
for(id key in dictionary)
    NSLog(@"key=%@", key);
 
Yeah a lot of languages have this functionality.
I just use the snippet above.
 
@Rapptz The const isn't necessary, keys in a map are const from the ouside, anyway.
 
Ell
yeah it's fine for for each
 
9:30 AM
@FredOverflow Doing auto key = p.first; would invoke a copy.
 
Yes, but auto& key is fine.
 
user1804599
Avoiding copies is for pussies.
 
@rightføld I got an email from Richard Pattis. He wants me to do a guest lecture at Stanford.
 
@FredOverflow It's deceitful to put that.
 
user1804599
Who is Richard Pattis?
 
9:31 AM
@rightføld The inventor of Karel.
 
It makes it seem like you can modify it when you can't. The const shows intent that you can't.
 
user1804599
Nice.
 
@rightføld And that mail is as real as your boner subway video ;)
 
user1804599
:v
 
@Rapptz Nah. Just like T* addressof(T&); doesn’t mean or look like ‘fetch address of mutable argument’.
 
9:32 AM
my favourite birdie ... just watch the first 5 seconds
 
auto is not a type.
 
I know it isn't.
Sticking to my guns!
 
While auto const certainly is full of intent regarding mutability, auto& isn’t :v
 
@chmod711telkitty what an ugly creature
 
You know.
Outside of for_each and apply I don't know what to put in this tuple header.
I butchered that sentence.
 
9:35 AM
 
Your programming style is quite perplexing m8.
either that or bitbucket syntax highlighting is bad
 
@Rapptz It looks awful on my Opera on Windows.
 
looking through it makes me question some of my design decisions
not in a bad way or anything
more so in a conceptual one :p
Is it worth the effort to make functor versions of functions?
 
Keep in mind that I try to push the envelope deliberately.
@Rapptz These days I tend to ask the question the other way around.
 
Functors are pretty neat in general.
 
9:40 AM
I.e. ‘Why do I still bother with function templates?’ (operator() notwithstanding)
 
First class functions in a way :p
 
Indeed.
 
but creating an instance is quite a pain in the ass
 
Actually, my pet peeve is naming.
struct transform { …implement… } constexpr transform {}; is tempting, isn’t it?
 
I find lambdas in C++ way too verbose. In modern languages I can just say x => x + 1 or something, and in C++ I have to write so much boilerplate.
 
Well, my pet peeve is naming and the peculiar look of such definitions :)
@Rapptz The error messages will show plus_type etc. though, not plus :(
On a somewhat unrelated matter, I’ve finally figured out what was bothering me about tuple_element all this time.
 
depends if you have carets enabled
error: no match for call to '(const plus_type) (test, test)'
     plus(test{}, test{});
                        ^
is quite nice
 
No, that absolutely mentions plus_type, not plus :s
Look again.
 
but the caret shows plus :(
 
Irrelevant. It’s your code, not the error message per se.
 
9:46 AM
I guess if I really wanted to I could do namespace detail { struct plus { ... }; } constexpr detail::plus plus{};
but I don't like having to make an instance in general
every TU get a copy and it feels pretty meh
I guess it's a "small price to pay" or something.
 
@Rapptz Do you never define constants then?
 
I do. I feel discriminatory towards functions though because regular functions don't do 'that' but constexpr instances do.
There's no way to avoid the whole copy per TU thing with constants I think.
 
I’m not sure why that’s worth worrying about. Isn’t the whole point of going functors to do things that functions can’t or don’t?
 
yeah
there are a lot of pros that come with things being functors tbh
but I feel iffy due to this (only) con I've found
 
But the names :Þ
 
9:51 AM
doesn't bug me as much!
 
(Also have you actually checked that the object files end up with a copy of the functor object?)
 
There was a talk with Niebler about how to write modern C++11 libraries
and Niebler stated how he liked using constexpr functor instances
and people were tearing it down pretty badly lol
talking about ODR, multithreading, etc.
It seemed like a controversial thing from the comments.
 
Any argument that stood out or had merit?
 
the ODR one
 
What of it?
1 min ago, by Luc Danton
(Also have you actually checked that the object files end up with a copy of the functor object?)
 
9:53 AM
lemme find the video
 
God no.
Fuck videos.
Please
 
haha
for my sake then :)
 
user1804599
 
Alright, go find the video for your sake.
 
I found it
and the time :p
 
9:56 AM
I see the misunderstanding.
@Rapptz Any argument from the comments that stood out or had merit?
16 mins ago, by Luc Danton
I.e. ‘Why do I still bother with function templates?’ (operator() notwithstanding)
 
I am watching it again
 
@Rapptz What did you click on that prompted your comments on anyway? reorder.hpp? Save for that one I think those headers are fairly vanilla.
 
I never noticed how controversial that slide was until now.
 
It is?
 
The talk is 1h33m and he spends the last 23m on that slide.
People kept asking him questions about it.
 

« first day (1464 days earlier)      last day (3478 days later) »