« first day (964 days earlier)      last day (4002 days later) » 

12:00 AM
@MooingDuck That's what I thought too, thanks
 
@MooingDuck I thought RVO kicked in when the return value was not a named variable?
 
@doug65536 you know how members functions have a hidden T* this parameter? RVO is effectively a T& return parameter. It assigns directly instead of making a copy. but format_commas returns a value from a stringstream member, not a local, so that can't work.
@Borgleader NRVO. Whatever.
I'm checking the spec, I sohuld know this stuff
 
It would be possible for the compiler to pass that hidden pointer to str so str gets that for hidden parameter. was wondering if that was something that I can expect to happen in real life
 
Both are pretty much equivalent.
You cannot skip the copying out of stringstream, though.
 
@doug65536 since the string is probably a member of the stringstream, it can't elide that copy at least. All others can be
 
12:07 AM
@R.MartinhoFernandes yes, it's not a good example. not much to elide
 
std::vector<char> function();
std::vector<char> data;
data = function(); //my interpretation of the spec seems to disallow RVO here?
 
Function return involves at least two constructions on paper. In practice it's closer to one.
 
duck's example would require a temporary then operator= gets the temporary, right?
 
@doug65536 I don't know if it requires a temporary per-se, but the function cannot directly put the results into data. (according to my interpretation)
 
@MooingDuck copy elision only applies to constructors.
 
12:16 AM
the spec says "the copy/move operation can be omitted by constructing the automatic object directly into the function's return value." (and similar)
 
@R.MartinhoFernandes No
 
@LucDanton spec seems to say so
 
You cannot elide assignments.
 
@R.MartinhoFernandes :(
 
@MooingDuck You just can't. What happens to the existing state?
 
12:19 AM
Personally I was talking about the function return :v The 'local construction inside function for return statement' => 'initialization of function return' elision.
 
is the compiler is allowed to pretend the code above says std::vector<char> data = function(); assuming flow analysis says it's ok?
 
Yes.
Code cannot tell the difference.
 
Part of me is imagining a calling convention where the caller passes a pointer to an already constructed "result object", and the function skips constructing it's own and assigns (via operator=) to the "result object directly.
No wait, that would totally screw with exception safety
@R.MartinhoFernandes I can totally write code that behaves differently if it elides that copy :D
 
Magic!
 
namely, if the vector being returned uses more than half the virtual memory....
and flow analysis couldn't detect that
well, I suppose it could
 
12:28 AM
in std::vector<char> data = function();, function would directly construct data, and data's memory will be uninitialized upon entry to function(), right?
in other words, it would allow (N)RVO to construct data directly, without having to construct data before calling function, right?
 
@doug65536 yes
 
#include <iliketrains.meme>
 
Should I build my 6k server inside a case that looks like a train?
 
1:21 AM
Alright, tonight we write sequences!
Might want to grab a bite first though.
 
Goes faster if your computer case looks like a train
 
@Mikhail Can't argue with that.
 
2:23 AM
@Mikhail 300W power supply? Is that for the computer, or one video card?
 
@JerryCoffin Its for a train
 
@Xeo ⋌ == (-flip / 2) λ ?
 
@Mikhail Is it part of an actual model railroad? You could use USB ports to physically transport data from one side of the room to the other.
 
The bandwidth for that could be amazing.
 
But think of the latency!
 
2:30 AM
> 'IteratoRange' is not a member of 'annex::concepts'
 
|0 1/2|
|1  0 | · λ
I'll never look at an eigenvalue the same way again.
Damn markdown. I'd spend all day at this if it weren't for the 2-min limit.
 
I noticed you picked the correct direction of rotation, unlike me. Well done.
 
2:44 AM
ADL via template parameters cramping my style once again.
 
2:56 AM
@LucDanton Use an identity metafunction to turn hide the argument.
 
That doesn't sound sane.
 
@LucDanton Never had reason to do so but it should be a valid workaround.
Assuming you mean you have a problem with an undesired association.
 
3:15 AM
@Potatoswatter That's template parameter of a class template.
 
@LucDanton Oh, those are toxic. Better if all template parameters are classes.
 
wat
It is. And it triggers ADL.
If you have template<typename T> struct ohnoes {}; and you attempt ohnoes<std::pair<int, int>> o; begin(o); then std::begin is in the candidate set.
 
oh, thought you meant template template parameter, which would need a special identity metafunction.
@LucDanton That illustration is a function template, which is harder to work around because a value must be passed.
If you do identity< std::pair<…> >::type, then std will be hidden.
 
What does that have to do with ADL?
 
@LucDanton It's a workaround to hide the associations of something. But I hadn't considered the need to preserve value. If o can't be an argument then it needs to be wrapped :( .
 
3:22 AM
It's nonsensical.
 
begin( thunk( o ) ) will not find begin using o's associations, it will use thunk instead.
 
What's the type of the result of thunk.
 
@LucDanton Something which converts to the type of o. A wrapper identity function.
 
No, spell it out.
 
Huh
This wasn't what I had in mind with my initial suggestion. I'd assumed you had an explicit template argument.
If association with xyz is undesired in foo< xyz >( bar ) then you can use foo< identity< xyz >::type >( bar ).
This business with wrappers is a bit of a tangent…
 
3:28 AM
I'd be surprised if that is true. Writing a testcase
 
gtg… good luck :)
 
hey hey hey C++ noobling here loving this website.
 
@Potatoswatter First case triggers ADL for the associated namespaces of bar. Doesn't care about xyz (what would that achieve?).
Keeping in mind the original motivation for ADL is operator templates.
 
yiz
generic avatar army
 
@LucDanton Original whatever. Alright, final workaround: defeat ADL by parenthesizing the function name, and specify all template arguments explicitly. Then you can identity out the undesired associations.
( foo< xyz, decltype( bar ) > )( bar )
If you're relying on overload resolution to find the correct template, then you're SOL.
 
3:36 AM
37 mins ago, by Luc Danton
That doesn't sound sane.
 
But this gets you ADL to find one template in whatever namespace xyz is in.
 
^ told you you're insane
 
Just bored and waiting for a slow process to complete.
 
yiz
I am preparing for my extreme hiking/camping trip starting tomorrow
 
@yiz Which part is extreme? The fact that you'll be hiking on your extremities?
 
yiz
3:40 AM
The fact I would be in the wild and possibly lose a gram or two
 
Then bring more than a few grams ;)
 
yiz
But I have prepared myself a lot of gourmet food
 
My cooking is better than my coding is chef
 
@yiz That sounds more like a necessary condition than extreme.
 
yiz
there is no hope of me losing any weight ... I could get lost for 10 days and I would still be not thin :(
@Potatoswatter I will be hiking 10km-20km everyday, most of the times with a 10kg backpack
half of which would consist of gourmet food of course :(
 
3:44 AM
@yiz Are you talking about marijuana here?
 
yiz
I am talking about losing weight while hiking
 
Marijuana is illegal.
 
Aaaah.
@user2442335 So....?
 
lol I just said that in case we weren't suppose to talk about weeds.
I'm smooth like that 8)
 
o.o
 
3:54 AM
@R.MartinhoFernandes Correct me if I'm wrong, but an Andrei bidi range is more like a bi-shrinkable range, right? Do you know if that's useful? And why must random-access ranges support that?
Oh right a RA range can also be forward + infinite.
 
@user2442335 We're all adults here.
 
@EtiennedeMartel I'm not at all sure I agree with that. I, for example, am more like an extremely over-age child. :-)
 
@JerryCoffin You are legally an adult. That's all I need.
 
@EtiennedeMartel Ah, well, I guess that much is true.
 
Because if we're talking about mental age, then I'm afraid there's not many adults in here.
 
4:01 AM
Does weed and coding mix? lol I find it helps me read through all these text books.
 
@user2442335 I have honestly no idea.
I rarely consume pot, and when I do, I'm always away from a keyboard.
 
I have ADHD and it helps, besides taking something that messes up my heart like adderall.
 
4:15 AM
@yiz 1. That's not far, would be a standard long-distance run, 2. That's not heavy, 3. With such light supplies you must not be out for many days.
 
yiz
tent < 1.5kg, sleeping bag = 0.8kg, stove = water from streams
 
This stupid "try this" in this book makes no sense.
The character 'b' is char('a'+1), 'c' is char('a'+2), etc. Usc a loop to write out
a table of characters with their corresponding integer values:
 
@R.MartinhoFernandes Oh I get it! That way you do reverse iteration by starting from the back. My unit test caught that :v
 
Can a char just be incremented? So that if char x = 'a' x++ would make it b?
 
@yiz Hadn't considered the possibility of boiling water. How much fuel are you bringing for the stove? If you screw up with that, your trip will get a bit extreme indeed.
 
4:27 AM
I think I'm being asked to do something I don't grasp in this book -.-;;;
 
yiz
we hikers move in herds, failing the stoves we will use wild camp fire, but I am bring 2 cans of fuel
 
@user2442335 In C and C++, char is just a small integer type, so you can increment one just fine. In theory, that's not required to give you the next letter though. In fact, except on an IBM mainframe it'll normally be fine.
 
@JerryCoffin So it can be incremented alphanumerically?
 
@user2442335 Note however that to get from 'a' to 'b' you need to know for sure the encoding in use. On the other hand u8'a' is followed by u8'b' by virtue of being UTF-8.
 
@user2442335 Yep. (Although it's not strictly specified by the Standard that the result is b.)
@user2442335 Numerals can be enumerated by incrementing according to the Standard, but not letters.
 
4:29 AM
It wants me to display the values of the characters in the loop.
 
@user2442335 As in the encoded value?
 
I'm not sure the wording makes no sense to me.
The character 'b' is char('a'+l), Ie' is char('a'+2), etc. Usc a loop to write out
a table of characters with their corresponding integer values:
a .7
b .8
z 122
err should be 97 and 98
 
That would be the encoded value, yes. A character is displayed as such by convention, but its representation is still a number. This is what the exercise is about.
Note that on each iteration of the loop you're asked to display both: the character as-is, and its encoding.
 
How does it get the number 97?
 
@user2442335 Perhaps this was covered in a previous exercise? Otherwise I can just tell you but just in case the material covers that.
As a hint: the encoded value of the character is a number. Have you displayed numbers before?
 
4:36 AM
I have two weeks to go from not much Java experience and no Android experience to a tower defence game. Challenge accepted.
 
They have yet to go over char yet. Besides saying it holds a single character.
 
@chris You sound pumped.
 
so int i = 'a' is like saying int i = 97?
 
@LucDanton Well, I was going to do a 3D game in C++ that had optional game controller input, but my teacher was strict on a Java requirement. I'm surprised he let us do Android. It should be a good experience anyway.
 
'Define i with the encoded value of 'a''.
 
4:38 AM
Yeah the book has yet to go over this.
How weird of him to make it a TRY THIS EXAMPLE out of it.
It hurts my growing because it makes me feel like I'm not understanding the material, or I'm dumb :/
 
@user2442335 A lot of what I read makes me feel dumb. That should be motivation.
@user2442335 You've seen that it's a bit more specific than this, but for the purposes of beginning, you can usually assume ASCII is used, and each character has its own numeric value according to that chart. C++ lets you go between the character representation and numerical representation pretty freely.
 
@LucDanton Guy's obviously a beginner. Bringing up encoding is a very bad idea.
 
Given that the exercise asks for that, no?
 
lol yeah been only working on this book for 3 days.
The exercise is poorly planned though!
 
@LucDanton Pretty sure the exercise is assuming ASCII.
 
4:46 AM
@Rapptz What is ASCII?
 
Would you prefer I call it Latin-1?
 
No, I'm asking for a definition.
 
"A character encoding"? Is that what you want me to say?
 
yiz
The American Standard Code for Information Interchange (ASCII ) is a character-encoding scheme originally based on the English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that use text. Most modern character-encoding schemes are based on ASCII, though they support many additional characters. ASCII developed from telegraphic codes. Its first commercial use was as a seven-bit teleprinter code promoted by Bell data services. Work on the ASCII standard began on October 6, 1960, with the first meeting of the American Standards Association...
 
I want you to say what it is. Would you say it's an encoding?
 
4:48 AM
So to answer your question about 'a' being 97, that's its ASCII value (which as mentioned, is the vastly most common encoding you'll see, but maybe not the only one). If it's type is char, it will print 'a'. If its type is int, it will print 97. They're really the same value.
 
Yes -- but telling a beginner about the differences in encoding is suicidal.
 
Is that what I'm doing, or am I using another term for 'numerical value' (which I think I've also used)?
@Rapptz Just to make sure, are you familiar with what a code is?
 
A code what?
 
Any code.
A code is a rule for converting a piece of information (for example, a letter, word, phrase, or gesture) into another form or representation (one sign into another sign), not necessarily of the same type. In communications and information processing, encoding is the process by which information from a source is converted into symbols to be communicated. Decoding is the reverse process, converting these code symbols back into information understandable by a receiver. One reason for coding is to enable communication in places where ordinary spoken or written language is difficult or...
 
Yes.
 
4:50 AM
ASCII is a code. The value of 'a' in that code being 97. Which is the encoding value. Etc.
 
I know.
I don't think we're on the right page
 
that ascii chart is ... uhm intresting?
 
What's wrong with using 'encoding value' and 'numerical value' interchangeably?
 
I think the easiest thing is to explain using the common assumptions and stick in the mind that it isn't always true. It leaves something hanging for later when they get more experience and can reasonably focus on it.
 
@chris Yeah that's where I'm going with this.
 
4:52 AM
Yo I'm not the one throwing ASCII around.
 
Well with help from a google search I was able to write the code.
I was thinking that I was going to have to make a array to store letters to display them XD
 
@LucDanton ASCII is what everyone goes through first. It's all you ever hear about. It might not always be strictly true, but it's good enough to get by as a beginner and learn more in-depth later.
 
I've never needed to know ASCII (or any other encoding) when being taught and I don't see what's interesting about it.
 
@LucDanton I think the appeal is just saying "A is 65 and 0 is 48" etc. Having some easy way to go between characters and numbers, and that's the first thing I see so many people jump to when answering. At least Unicode kept it the same, so it's not like saying A's value is 65 in the general case is wrong. By the time it matters whether it's 65 or not, you should have gotten around to knowing why.
 
@chris After some thinking I disagree entirely. I've never used, discussed, needed, or cared about ASCII when learning and neither did my classmates.
 
4:58 AM
Does every character have a numeric value then?
 
@user2442335 Yes. Computers deal with numbers exclusively.
 
Even pointers are numbers.
 
@LucDanton How'd you deal with characters?
 
i.e. isdigit and what not
or turning a character '9' to numerical value 9.
 
4:59 AM
@user2442335 Yeah, the trick is which number it is. That's where all of these different standards come into play.
 
@Rapptz E.g. atoi and whatever OCaml equivalent if that ever came up, some of us might have used '9' - c too.
 
Mmm okay. I never knew I could initialize ints with characters. I thought it would spit out a error. Thank you everyone. I learned quite a lot xD
 
@Rapptz Sorry, why do you bring up isdigit?
 
@LucDanton c - '0'?
 
@chris That does look more sensible.
@user2442335 Honestly it's a sensible expectation.
 
5:02 AM
@LucDanton Standard isdigit from cctype assumes 8-bit char.
I think anyway
 
Sounds unlikely.
 
@Rapptz Isn't it for MBCS? I honestly can't remember. It's still all just better off with Unicode.
 
So what kinds of video games does everyone like here :P?
I'm about to play some World of Tanks to let my mind rest after all that XD
 
> The representation of each member of the source and execution basic character sets shall fit in a byte.
@Rapptz ^ so no.
 
How do you pronounce ascii :P?
 
5:11 AM
ass-key
 
@R.MartinhoFernandes I'm switching to Andrei-style ranges. The twist being a start(r) operation to prime the range -- the purpose is mostly that I can write a C++- to Andrei-range adapter, with state { Range range; ephemeral<pair<It, It>> current; }. So current is cooked even after the adapter (and possibly the embedded range) has been moved around. Then C++ maps exactly to Andrei AFAICT.
And I'm going horribly slowly because I'm knee-deep in iterator/Boost crap.
 
@Rapptz lol really? I've been saying aa-see
 
that's a sweet ass-key.
 
> The American Standard Code for Information Interchange (ASCII /ˈæski/ ASS-kee)[1]
 
Hello guys i trying to do something like this but i getting error

bool human = true;
cout << human == true ? "you're human" : "you're not human" << endl;
 
Try parens around the conditional expression.
 
the == true is redundant if you care about that
 
thank you it working
@Rapptz you mean cout << (human) ? "you're human" : "you're not human" << endl;
 
(human ? "yes" : "no")
 
oh ok thank you
 
5:22 AM
If you find that perplexing perhaps using bool is_human = true; for the variable name would help: (is_human ? "yes" : "no").
 
yes it would be better
 
to be fair, human? is a valid English question.
 
That operator always looks weird chained.
 
yiz
anyone here good with Java?
protected String doInBackground(String... url)
... means undisclosed amount of parameters?
 
5:31 AM
Yes
I really want that in C++.
did anyone ever write a proposal for it
There are obviously a few ways around it but meh.
 
variadic templates don't cut it?
 
You can't have variadic templates of the same type in a function.
explicitly anyway
 
@Rapptz, template<int... ints> void foo(ints... args){}
 
I use a typed head and template ...tail type.
 
That's an error. foo<0> -> void foo<0>(0 args); // wut?
 
5:40 AM
@chris You can't.
 
I know I have before. That only works with some types, though. You'd have to expand this sketch: coliru.stacked-crooked.com/…
 
6 mins ago, by Rapptz
There are obviously a few ways around it but meh.
 
Unless I'm being stupid and that's only for template parameters.
 
My problem has a solution but meh :)
 
I know you can bypass it, I just think it would be nice to do so without the extra verbosity.
 
5:43 AM
C++ is the definition of verbosity.
I agree some things would be nice to not be so verbose, though.
 
It's gotten better.
But I still think it would be nice to do something similar to what you showed without erroring.
 
They won't even allow omitting the auto in lambdas. Lambdas are supposed to be short.
 
lol [](a, b) { return a == b; }
Won't lie, that's pretty lovely.
 
I like C#'s: (a,b) => a == b;
 
yeah
 
5:45 AM
I kind of like the idea of lambdas for normal functions as well:

[]max(a, b) {
return a > b ? a : b;
}
I doubt that'll fly with C++, though, even if it is easy to implement.
 
There are $2 bills?
 
@chris I like Haskell's too, i.e. \a b -> a == b
 
I think I should learn more Haskell.
Does studying Haskell help to deepen insight in C++ TMP?
My computer was playing music during the night. I woke up to this song.
 
lol
 
It's ironic that this turns out to be the subreddit that I find most interesting.
 

« first day (964 days earlier)      last day (4002 days later) »