« first day (1474 days earlier)      last day (3476 days later) » 

10:00 PM
 
Looks like I’ve been doing it wrong though. Better dive into the Standard.
 
@Puppy I'm happy I don't have to pay for my bills though.
Free food, too!
 
Puppy must have had a bad childhood.
 
High school was the best
 
Wouldn't know.
 
Xeo
10:03 PM
@LucDanton Meh, I'll just go with sizeof(Left) > sizeof(Right) ? sizeof(Left) : sizeof(Right), I guess
and then one aligned_storage of that size
 
Simpler times
 
Xeo
@LucDanton Guarantees proper alignment for all types
or something
 
@Xeo I’m looking into that.
 
@Rapptz you didn't take high school?
 
aligned_storage<max(sizeof(args)...), max(alignof(args)...)>?
 
10:04 PM
libstdc++ does take the maximum alignment, which is what I’ve been doing as well.
 
@Nooble Not like the regular kids.
 
Xeo
@Rapptz ye, I guess. VC++ has this weird recursive implementation
 
@Rapptz Elaborate, please.
 
I didn't go to high school at 13-18.
 
Oh wait, that’s what aligned_union_t is specified to do. While at the same time it is ‘suitable for use as unitialized storage for any object whose type is listed in Types […]’. Good enough for me then.
> The member typedef type shall be a POD type suitable for use as uninitialized storage for any object whose size is at most Len and whose alignment is a divisor of Align.
^for aligned_storage_t, and the source of my confusion
 
10:07 PM
@Rapptz It's 14-18, I believe. Did you take it later? If so for what reason?
 
HS is 3 years here
 
I didn't take it later. I skipped it. I went to college instead.
@Nooble Same thing. 13-17, 14-18. Depends on your birthday.
 
Xeo
@Rapptz Ah, VS2013 also has that implementation. 2012 has the weird one
static const size_t _Max_len = _Maximum<
    _Len, sizeof(_Types)...>::value;    // NOT sizeof...(_Types)
 
@Rapptz You skipped and went straight to HS or did you take a 3-4 year break? My parents would never let me do this.
 
Xeo
lol'd at the comment
 
10:09 PM
@Rapptz Ahh, okay.
 
@Rapptz what do you think about returning values from the tuple visitor?
 
Xeo
@Rapptz Actuall, std::alignment_of
 
@Nooble I "went" to high school at 8 to age 12. I just took some classes while I stayed in another school and when I was of age to go to high school I skipped it and went to college instead.
@Xeo I don't know the difference outside of that being an integral constant class.
 
Xeo
returns alignment of array members, and for references of the referenced type
i.e., std::alignment_of<T[N]> -> alignof(T) - std::alignment_of<T&> -> alignof(T)
 
Ah cool.
 
10:12 PM
std::alignment_of is a query for alignof. AFAICT alignof does everything you said.
 
That's what I thought.
 
Better go back in time to n36xx to see what happened.
 
cppreference says std::alignment_of<T>::value is equivalent to alignof(T)
 
Xeo
hm
 
what does the standard say?
 
10:13 PM
That.
 
Xeo
> Note: This type trait predates the alignof keyword, which can be used to obtain the same value with less verbosity.
Welp!
 
Oh yeah, that rings a bell.
 
Xeo
nvm me then
 
that explains why there isn't std::size_of
I guess
 
Needs std::declared_type_of, too!
 
Xeo
10:13 PM
@LucDanton lol
 
@Xeo Oh yeah. VS doesn't have constexpr so they can't use the neato constexpr max function.
 
Ell
@Rapptz you clever pumpkin
 
the implementation with max(alignof(args)...) is actually how I do it
it's pretty clean looking to me
@Ell lol thanks
 
btw the variant proposal calls for a literal type, so no aligned storage!
 
Ell
I'm the opposite of you
 
10:18 PM
constexpr variant?
 
Yes.
 
how is that possible?!
 
Works for optional, so I assume unions/variant(hah) members.
 
I had a hard enough time with constexpr optional
 
Oh right.
 
Ell
10:19 PM
constexpr just means evaluated at compile time doesn't it? (I have so much to learn!)
 
Xeo
potentially
 
it means it can be evaluated at compile-time if you want it to
 
It’s naive tuples all over again: union generic_union { Head head; generic_union<Tail> tail; };.
^I don’t know of a better implementation.
 
sounds like an implementation nightmare tbh
 
Xeo
@LucDanton That's how VS2012's implementation of aligned_union looks like
 
10:20 PM
@Xeo …wow
 
wait so how do you query stuff in an aligned union?
 
@Rapptz No no that’s not what std::aligned_union_t does.
 
Xeo
you don't
it's just for storage
 
what a crappy name
wtf
0
Q: How to optimize the FizzBuzz program

Donald Knuth was Wrong"Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”." What are some things that can be done to further cut down th...

 
Can I get a sanity check for the implementation? Reasoning is that we get better tuples thanks to inheritance, but that’s not an option here (everything must be in the one union).
 
10:23 PM
@Rapptz lol..................
 
That’s actually how I implemented my first variant, too. I switched away from it because it sucked :s
 
@Rapptz Coming from the guy called "Donald Knuth was wrong". See his other question - it's even more fun.
 
Sublime Text's python interpreter is so helpful
 
user1804599
> I hear string addition is inefficient.
 
user1804599
10:32 PM
top kek
 
Ell
I need @Borgleader the gamedev again. I want to store a scene (in memory) in a renderer independent way. howw dooo
 
Save game state.
 
Ell
save game state?
 
Wait. What do you mean by "scene"?
 
We are investigating a network incident that blipped the sites over here, but are online at this time.
 
Ell
10:39 PM
@Jefffrey like cameras, lights, model positions
 
In a specific frame?
 
Ell
Sure.
Just in general
basically I want to pass some structure to a renderer
Idk what this structure should be
I mean I guess in a tree of some kind
 
There’s such a thing as scene graphs, but that needn’t be what’s actually passed to the renderer.
 
Ell
Well, the renderer being some object which calls opengl functions
like you could have DeferredShadingRenderer or ForwardShadingRenderer
 
lol
 
10:50 PM
Hello I just have a simple question
 
codereview.se has been in beta for almost 4 years
 
It's not worth posting on StackOverflow, so I thought it would be better here
 
> 1379
days in beta
 
can I ask it here?
 
@Andy Why not?
 
10:50 PM
on SO people will write code, and stuff
 
What's the question?
 
if it's not worth posting on SO
you can be sure we'll take an extra big shit on it here
 
no it's nothing big
okay
 
@Puppy s/we/I/
 
so
I'm trying to overload the insertion operator >>
so that whenever I use cin>>x; and x being an object of type Fraction, the number I enter
for example 1/2 gets stored in to x's numerator and denomenator
 
Xeo
10:53 PM
That's cool, good luck!
 
so 1 would be stored in variable called numo,
and 1 would be stored in a variable called deno
numo and deno are private int variables decalred in the class Fraction
 
@Andy It's SO worthy. Go post it there.
 
okay
 
user1804599
What's with Andy?
 
make sure that you ask that nobody downvote you
and that they help you urgently.
 
user1646075
10:54 PM
@Andy the only real answer is code. You have strings to slice, or complicated scanfs or >>'s to write.
 
otherwise they will downvote you and not help you at all.
 
@aclarke I have started coing
here's what I have:
 
user1804599
inb4 wall o' code with whitespace fail
 
NO no
don't post your code
 
user1646075
@Andy I cooed at a pidgeon, and it tried to screw my shoe.
 
10:55 PM
istream &operator>>( istream &input, Fraction fraction)
{
input >> getline(cin, input)>> fraction.numo;
input >>getline(cin, input);
input >>getline(cin, input)>>fraction.deno;

return input;
}
 
@rightføld lol
It looks like you have no idea what you are doing whatsoever.
 
lol true
 
called it
 
user1804599
@Andy top kek
 
@rightføld what does that mean?
 
10:57 PM
@Andy Can you please ask it on Stack Overflow?
 
okay
 
user1804599
@Andy it means you're bad at C++
 
almost as bad as Zoidberg
 
@Andy And maybe read a book first.
 
I'm just learning C++
today is like my third day of learning
that's why
 
10:58 PM
@Andy What book are you reading?
 
But you know what, we all were begginers at some point or another.
 
@Andy This is true.
 
user1804599
> 12.5 kilogram golden bar
€ 390.960,00
 
C++ How to Program 8th Edition
 
user1804599
Gold doesn't decrease in value, right?
 
user1804599
10:59 PM
As in the value is fairly constant.
 
it certainly can do.
 
Of course it does
 
user1804599
Are those decreases significant?
 
user1646075
@rightføld over what time scale are we talking?
 
yes.
 
11:00 PM
Wait, but I don't need people to write the code for me
It's cheating
I need to learn how to do it.
 
user1804599
@aclarke until I buy shit that makes me poor enough not to have to pay 1.2% tax over my capital.
 
that's why I don't want to post on SO
 
4275
Q: The Definitive C++ Book Guide and List

grepsedawkThis question attempts to collect the few pearls among the dozens of bad C++ books that are published every year. Unlike many other programming languages, which are often picked up on the go from tutorials found on the Internet, few are able to quickly pick up C++ without studying a well-written...

 
user1804599
The tax doesn't apply to gold, hence I'm considering it.
 
If it's not there burn it and get one that is in that list.
 
user1646075
11:01 PM
@Andy WE HAVE A WINNER! You'll go far, young man.
 
@Andy OK, that's a good start.
 
@aclarke thanks
so anyone willing to help me here or explain what I am doing wrong
 
@Andy Put that in your question. Ask for an explanation.
 
the problem is that you don't know what getline and >> actually do.
 
user1804599
Or until morons stop voting labour and socialist parties.
 
11:02 PM
@puppy true
 
if you did, you would not have written that code.
 
user1646075
aww, people are pissing on my fizzbuzz answer. Some people are So Serious.
 
try looking up their definitions on a reference site like cppreference or MSDN.
 
user1646075
I'll get my massive rep-points back when the Q is deleted, right?
 
no
 
user1646075
11:03 PM
oh well
 
user1804599
WTF
 
you'll never see those points again
 
user1804599
€18.10 to go from Roosendaal to Utrecht by train.
 
okay, all I am trying to do is that if a user enters something like: 1 / -2
that insertion operator gets 1 and assigns the variable numo to 1
and gets / and ignores it
and gets -2 and assigns it to deno
but I need to use a function to do that
I was thinking of using getline()
 
user1646075
@Jefffrey only had them for 3 days. An answer from 2 years ago gives me 10 every 3 months. Wierd
 
11:04 PM
nope
getline: unuseful.
in this situation.
 
then what?
 
well, you need to decompose your problem.
you want to read "1 / -2".
 
user1804599
if getline is unuseful, then ungetline must be useful!
 
that means you need to read "1", then "/", then "-2".
 
yes
 
11:05 PM
this pretty clearly implies that you need to do exactly three things to read the input.
and none of them have anything to do with lines.
 
this is cute
 
@Puppy except that the user enters one line and then you're supposed to parse it
 
so can I just do input >>cin>> fraction.numo and this would do that job?
 
@nightcracker Implementation detail.
 
puppy found his new bro
 
11:06 PM
@Puppy I guess since he's a beginner you can suggest using formatted input
 
wtf is with you and input >> cin >> something.
that's not how it's supposed to work at all.
 
but I hate formatted input :(
 
:(
okay let's start from the begining
 
begging
 
operator overloading
 
11:07 PM
no no no
 
lol
 
that's not the beginning lol
"let's start with the beginning -> quantum overdrive interlocking"
 
operator overloading is a bit of an implementation detail you don't really need to know right now.
all that matters is x >> y has certain semantics, for some types of x and y.
how that's implemented is not really important.
 
okay
 
ITT everything is implementation detail you don't need to know
2
 
11:08 PM
welcome to "high level" languages
 
Hello.
 
Okay @puppy so I need to somehow divide the user input into sections
 
Aye
 
11:09 PM
you don't really need to.
cin can do it by itself.
just read each one one by one.
 
what if user inputs "1"?
is that valid input?
 
no
we assume that user inputs valid fractions only
 
christ man
 
is "1/3" valid?
 
11:10 PM
is "1 /3" valid?
 
haha
 
@Jeffery yes
 
@Andy then don't listen to puppy
 
okay, now I'm just more confused
 
thanks puppy
 
11:12 PM
why didn't you ask on SO
ask on SO
 
because people will write code and that's cheating
4
 
lol
 
you're cheating right now bub
 
I want to learn the concept behind it
 
@Griwes I am curious what was the cause. Once again imperial versus metric system in code? :)
 
user1646075
11:12 PM
1/ learn to read a single number
2/ learn to read a single character and prove it's /
3/ rinse, repeat
 
hell
 
@Andy Is "1 / (1 / 2)" valid?
 
@nightcracker IT'S ABOUT TIME!
 
Is "1 / / 2" valid?
what about " / 4 /2142/3 // "?
 
you guys are being stupid on purpose
 
11:14 PM
what about "(//14)4-24(13/x /("?
 
@aclarke 1) cin>>var_name; // var_name of type int or double
2) cin>>ch; // ch is of type char
no no no
 
please
 
just normal fractions like 1/2 or 1/3
 
if you are using using namespace std; delete that line right now
 
@Rapptz nah, I'm like that 4 real
 
11:15 PM
okay
 
user1646075
@Andy then you're pretty much done, apart from error checking if you care to reject crap input.
 
./kick jefffrey
 
there is no such thing as cin, it's std::cin
 
@nightcracker yes that's super important right now
@Rapptz <3
@nightcracker it's ::std::cin
 
@Jefffrey using namespace std; is a major noobtrap that only hurts understanding at the cost of saving a few keystrokes
 
user1646075
11:16 PM
except you are passing input to your function, yet you are mentioning cin...
 
Meh, I stopped using namespace std; as soon as I've written my first header file.
 
I used to think using namespace std; was required when I was a nub.
 
me too
 
real men use namespace EnterpriseStandardLibrary_vCPLUSPLUS11 = std;
 
Ell
I've been drinkin' I've been drinkin'
 
11:19 PM
gamedev leads to alcoholism, more at 11
 
god I don't think I've ever used namespace aliases except with boost asio
gamedev seems fun until you do gamedev lol
 
user1646075
need a few more downvotes to kill this thing off. otherwise I might say something I regret. stackoverflow.com/questions/26641677/…
 
you know
you can just close that tab
 
user1646075
yeah, but it's also sort-of fun.
 
user1646075
as long as I don't go orbital with it...
 
11:28 PM
try using more staging and fuel ducts.
 
user1646075
and a 6 second self-destruct trigger
 
user1646075
then a rage-quit that is not a rage-quit.
 
@FlorianWolters I've simplified my answer after you've clarified your question quite a bit. Hope this helps. (Note: this answer was already there, I just removed the DNS lookup that appeared to confuse you) — sehe 4 mins ago
Raege
 
Ell
I guess a scene graph is fine
 
@Florian With all due respect, I'm baffled why you downvoted my answer, where I show exactly how to use address_v4::broadcast with a netmask. Your claim that broadcast() always returns 255.255.255.255 was just invalid, and had you actually read the answer, complete with the output shown, you'd have seen that. Also, no this is not called resolution. You may want to call it derivation or calculation. To resolve, in the context of IP, specifically means using a naming service to resolve host or service addresses. — sehe 17 secs ago
 
11:30 PM
JIF loading is so terrible here
 
I wonder, why was sizeof... made a language feature rather than std::arity<Args...>::value or something
as strictly speaking it's not necessary
(I'm not complaining, but just wondering since usually they leave things to the library when it's not needed to be a language core)
 
user1646075
@nightcracker sizeof is ancient and has been around since before C was quite called C ?
 
@Jefffrey Head, Tail...
@aclarke sizeof..., not sizeof
 
user1646075
oh, carry on. I tend to read ... as a pause in speaking
 
... and ... are clearly... different.
 
user1646075
11:34 PM
this is one party I'd like to be at: worldbuilding.stackexchange.com/questions/3188/…
 
user1646075
/polishes tears from glasses.
oh, yeah...
 
:,|
 
@aclarke why isn't this working:
// insertion operator overloading
istream &operator>>( istream &input, Fraction fraction)
{
input >> fraction.numo;
input >> fraction.ch;
input >>fraction.deno;

return input;
}
 
user1646075
are you wondering why fraction doesn't appear to have a value when the function returns?
 
dat Fraction fraction
 
11:39 PM
NO,I get an error that numo is private
 
user1646075
ohhhhh
 
and also another error that ch, and deno are private as well
 
@aclarke he will also have that problem
later
@Andy are they private in the class Fraction?
 
yes
 
then you understand what's wrong, right?
 
user1646075
11:40 PM
/holds back on answer...
 
but in Fraction header file I have :
`friend istream &operator>>( istream &, const Fraction &);`
 
user1646075
that's not the same function.
 
is istream &operator>>( istream &, const Fraction &); and istream &operator>>( istream &, Fraction); the same?
 
no
 
@Andy why would that be const... <whistle/>
 
11:42 PM
@Andy There you go. What's your plan now?
 
user1646075
also, given that accessing the two parts of a fraction is so ... essential ... to this data type, I would suggest they be public anyway. Most things, not, these things, yes.
 
user1646075
@sehe rote-learning gets in the way of true understanding. Imagine I said that in the voice of Master Po.
 
@aclarke but in header file, I declared the operator overloading to be a friend, shouldn't it have access to private member of Fraction?
@Jefffrey take out the const I guess
but it still doesn't fix the problem
 
@Andy why?
 
user1646075
But everywhere you use this thing, SURELY you'll be interested in the two values. eg Complex numbers have their sub-members directly accessible. Like I said, for most classes this is risky, but for special ones, it's good value, because it's what you'll WANT to be doing without shame.
 
11:47 PM
-5
Q: Code compiles fine in Visual Studio, but not in Unix terminal using g++. Why?

NestleThe code compiles, and runs as expected using Visual Studio. I understand that never guarantees it will compile/run elsewhere, but I don't understand why in this instance. Perhaps someone can help clarify? Here's the full list of errors that pop up in g++:

 
so that the operator overloading can change the values of an object Fraction. @Jefffrey
 
@Andy good
 
@Rapptz screen shot..
 
user1646075
@Rapptz i ain't going there. lost 4 points already today.
 
@Andy what is your operator>> "signature"?
 
11:49 PM
// obliterate seems a very apt comment — sehe 6 secs ago
 
Ell
to continue drinking or to not continue drinking?
 
To continue breathing
 
lol
 
istream &operator>>( istream &,Fraction &); @Jefffrey
 
@Andy what does your friend declaration look?
 
11:51 PM
friend istream &operator>>( istream &, Fraction &);
 
@Ell ..that is the, (bad), question.
 
is it "working" now?
 
No
 
SSCCE please
 
Ell
Alcohol is not the answer! It's the question. And the answer is yes.
 
11:51 PM
I try to compile implemenation but lots of error
with private
 
Do you know what an SSCCE is?
 
I believe the Official Stack Exchange Acronym™ is now MCVE.
 
Yeah. They decided it should be More Confusing(TM)
> 4. Design Patterns not widely used

Only singleton and factories are widely used. Few projects use other patterns. Even if C++ has more interesting patterns like described here, they are not widely used. For example, few projects use the NVI pattern.
This blog post manages to be damning and upbeat at the same time
 
okay, I'll just post it as a question on SO
 
struct B { double b{ std::reinterpret_cast<double>(2) }; };
wtf
 
11:55 PM
@Andy What a splendid idea
@Rapptz lolwut. reinterpreting a prvalue. well, a temp by that time
Probably someone who thought "reinterpretation" is a nice words than "cast"
 
Don’t miss the std::.
 
wat
 
user1646075
@Ell "𝄞 𝅗𝅥 𝅘𝅥𝅮 What's the point 𝅘𝅥𝅮𝅘𝅥𝅮 of getting so-oo-ber, 𝆒 when you gotta git drunk 𝆓 ahhh-gain 𝅘𝅥𝅮𝅘𝅥𝅮"
 
It’s not a composer key.
 
Found from here. It's been edited out though.
Still uses the reinterpret_cast though.
 
Ell
11:57 PM
I'm sad so I think I'll stop
 
user1646075
@Ell why so sad?
 
user1646075
is it because your avatar does not express your true personality?
 
user1646075
yes, that subject AGAIN.
 
Ell
Its cos I cant see my friend when they are back from uni because I have to work
 

« first day (1474 days earlier)      last day (3476 days later) »