« first day (883 days earlier)      last day (4291 days later) » 

05:17
question
pleease help me
Answer
i got a Lambda function
for_each(
a, b,
[](int i)
{
//do something
}
);
And I got the need to feel the breeze between my knees.
who do i modify insdie the doseomthing so i can change a to stop this lambda function from running forever?
*how
Yoooooooou....
... don't. :D
E.g. there's no "cancel the for_each" parameter that the lambda can take.
Limit the range you're iterating over or provide a valid range/iterator pair.
05:19
i just want to stop this lambda function running forever by changing the value of a
what if i pass by reference??
Ask about a problem, not about a bad solution.
If your function is running infinitely, you're doing your for_each wrong.
please
anyone can think about a way to perhaps stop this loop?
please doesn't add clarity to the problem you're trying to solve.
I'm sure abort(); will stop it.
05:21
Your problem: your for_each is running infinitely (I guess?).
ok i am trying to use lambda function instead of a loop to take in user input
Solution: fix whatever the hell a and b are so you're not looping forever.
Do you even understand what for_each is trying to do?
when user enter a special char i want to change a so that the lambda function stops
...
05:22
"(...) i want to change a so that (...)"
Stop insisting on making a bad solution part of your problem.
how is it a bad solution?
i am trying to use lambda function instead of a loop
Perhaps the fact that it is impossible might help out.
bool your_solution_sucks = false;

while ( !your_solution_sucks ) {

     // Do shit.
     if ( special_user_input )
       break; // alternatively, set your_solution_sucks to "true"

}
@RyanFung What's the original loop like?
while(string != "something"){ //do something}
from that to a lambda
05:25
Erm.
Yeah, no.
What you have is fine already.
There's no reason to Lambda that.
At all.
Do not use a lambda. It is inappropriate.
it is require by my instrutor
[] {
    while(string != "something"){ //do something}
}();
whoa what
They have C++11 classes now?
@Rapptz And as bad as ever!
05:27
yep
python's slow as shit
I'm going to cry
auto suck_my_lambda = []() { std::cout << "Fuck University" << std::endl; };
while(string != "something"){ suck_my_lambda(); }
come on
don't be mean
Stop being mean to my brain.
I don't get why that requires a lambda
05:28
i guess i wasn't welcomed to be here
a lambda is supposed to be an anonymous, temporary function
what use does your impose?
@RyanFung 2nd one to say this today
There is a room that's great for you: it's called Real C++ !
"Here, I have this terrible question." "We don't even know how to begin answering that" "I see I am not welcome here"
05:29
bye and thanks for your help and ThePhD you are mean
I guess we should rename the room to Lounge<Assholes, C++>
@RyanFung <333
I love you too honeybiscuits! <3
yeah ThePhD
you faggot
stop being so mean
Ahh, I'm such a faggot~
2
05:30
... I should edit that before it gets taken out of context.
@ThePhD Too bad it's been starred. :-P
Noo don't star it now I don't want to edit it because then the starboard willb e wrong. D:
Ffffffffff conflicting morals.
I wasn't even going to star that until you said you was going to edit it. lol.
:c
TIL: do, then speak.
Starbait!
05:32
It really baffles me, you know. Lambdas are quite useful, and yet that dumbass instructor (seriously, what else can we call them?) cannot even come up with a decent exercise involving them.
You're not even ashamed.
@R.MartinhoFernandes lol.
I use lambdas for callbacks.
It's so damn easy to come up with use cases.
@Rapptz That would require you to store a std::function
And instructors can't be seen using those!
05:32
@R.MartinhoFernandes Seriously, if you can't come up with an example, just pull one from Wikipedia for fuck's sake.
It's part of the std:: library!!
@ThePhD Still a lambda :@
well how it's used
btw my question is stupid
and i realizes
glad you noticed
Stars for learning.
05:33
In computer programming, an anonymous function (also function constant, function literal, or lambda function) is a function (or a subroutine) defined, and possibly called, without being bound to an identifier. Anonymous functions are convenient to pass as an argument to a higher-order function and are ubiquitous in languages with first-class functions such as Haskell. Anonymous functions are a form of nested function, in that they allow access to the variable in the scope of the containing function (non-local variables). Unlike named nested functions, they cannot be recursive without the as...
not trying to troll u guys
There, tons of examples.
just trying to see anyone can give me another direct to think about this
#include<functional>
#include<vector>
#include<iostream>
double eval(std::function<double(double)> f, double x = 2.0){return f(x);}
int main(){
   std::function<double(double)> f0    = [](double x){return 1;};
   auto                          f1    = [](double x){return x;};
   decltype(f0)                  fa[3] = {f0,f1,[](double x){return x*x;}};
   std::vector<decltype(f0)>     fv    = {f0,f1};
   fv.push_back                  ([](double x){return x*x;});
   for(int i=0;i<fv.size();i++)  std::cout << fv[i](2.0) << "\n";
this is close to the ugliest formatted code I've seen :(
... o_O
What is going on there?
05:34
Gosh, the alignment.
I got it from the wiki article
Okay maybe let's not direct stupid instructors to wiki articles then.
I am bored.
user1357851
Try this with your teeth if you are really bored :x
user1357851
05:47
hey guys, I've got a type deduction problem
picture this:
template<typename T, typename ...TParams>
T* Foo(const Bar& bar, TParams... params)
{
	T* object = reinterpret_cast<T*>(Allocate(sizeof(T)));
	return new (object) T(params...);
}
this works in most cases
but when I try to turn a pointer to an abstract type into a reference, like this:
IBaz* baz = /* get pointer to object of concrete type */;
obj->Foo(bar, *baz);
@Rapptz :O mind = blown
the compiler (clang) complains that it can't do it because IBaz is an abstract type
and my comprehension is that it thinks I'm trying to pass it by copy, even though there's a reference overload that would do just fine
Accept TParams&&..., use std::forward<TParams>(params)....
05:55
that fourth period is weird
The non-monospaced space renders differently on my screen. Oh wait, is that what you said? That's the point!
yeah I can see the difference
I figured it would be something like that
@Rapptz HE DID GERUDO VALLEY
YEEEE HEE EHEE HEEEEEEEEEE
OH YM GOD THIS IS AMAZING I'M DOWNLOADING EVERYTHING HE'S DONE
lol Gerudo Valley
OoT had some great music
06:00
I really like..
@Rapptz
|
|
|
v
lol
this doesn't sound like gerudo valley
oh nvm
:P
I think
I'm going to send this Smooth McGroove guy a hand-written letter
when my game goes further along.
I want himt to do the music to my 2D game
I think acapella on a game like that would be sexual.
ahaha. Good luck.
He's probably a serious professional.
It's gonna be goddamn hard to ask him to help with no pay. x_x
I'll have to make my game so good and then lure him in.
RAPPTZ REMEMBER THIS I MUST HAVE SMOOTHMCGROOVE
When I get too ambitious I rethink things.
06:13
When I get too ambitious I just go in deeper!
sbi
sbi
06:43
Why the hell does everybody think they're missing me?
@Cicada As if you could keep your moth shut.
Meh. You people are boooooring. Goes back to making his slides.
Slides?
Fr a presentation? :O
sbi
sbi
11 hours ago, by sbi
I have a problem. On Tuesday I was informed that there's a C++ seminar for which they are looking for someone to do it. I inquired, because the payment seemed quite good.
Ooooh.
sbi
sbi
11 hours ago, by sbi
Yesterday I signed a contract. To do a seminar from Monday-Thursday. Next week.
Yeah, Grumpy Ape showin' everyone how it's done!
sbi
sbi
06:52
OH, and it's actually Mon-Fri. Shiver.
@ThePhD You mean because I am to cook up slides and a presentation within 60hrs to teach people C++? That's not how it's done!
And we won't get people like we did like, 2 hours ago.
sbi
sbi
@ThePhD What?
@sbi Oh. I thought it'd just be a primer or something. Well, no harm if it's making you money. :D
sbi
sbi
@ThePhD It's a primer. They are embedded C guys. Those are the worst to teach C++ to.
... Oooh.
Damn.
Convincing them to use the STL is gonna be funbuckets.
user1357851
06:55
Get yourself some C++ books, then take the summary from each chapter and make them into slides
user1357851
easy
@sbi Just, the person I linked to (Ryan Fung). Incredibly confused about C++11 from some whack professor. :c
user1357851
Like we didn't back in the newb days in uni, I know I did
user1357851
But talented newbs can turn into pros
sbi
sbi
@ThePhD Oh, I think know enough to convince them alright. I am doing embedded stuff in C++ myself now, after all.
It's just that I was stupid enough to look up what the seminar costs the companies who sent those guys there. And now that I know they are paying a 4-digit number, I am terrified about their expectations.
user1357851
06:57
dumbass newbs stop being a newb after a while, but remind dumbasses
sbi
sbi
@ThePhD Apparently he's also terribly confused about spelling.
I did 40 slides about simple and polymorphic inheritance last night. MI is up next. And the kids are all over me wanting breakfast.
Why did I do this?
Ha! I just made the kids making breakfast. MI it is, then. Off.
Damn. Anybody has a good example for MI?
I have two that I used over the years, but they aren't all that good, and I'd rather have a better one now.
HULLO?! Room? Anybody home? What's with you, Merkins? You should spend a great night here at the lounge now!
Uh. Not to be that guy, but...
... What is MI? >.>
Also, Robot stayed awake all night (I don't know if he's managed to stay up this long), Etienne tapped out a loong while ago, coshman was here for a brief stint before tapping out.
I think only me and Telkitty are still awake.
sbi
sbi
@ThePhD Multiple Inheritance.
Oooooh.
That thing yeah. Um. I guess MI could be cool. I never actually fully use it.
sbi
sbi
@ThePhD That's two thirds Europeans you're speaking about there!
@ThePhD I have him plonked. For good reason, I keep hearing.
@ThePhD That's the problem with MI. When you really need it it's cool to code in a language that has it. But you rarely ever need it, and most of the times people think they need it, they should redesign. (In that, it's even worse than operator overloading.)
I can't remember when I have last used MI.
Mhmm. Except for interface inheritance, that is.
07:08
MI might be for when you make interfaces?
Yeah, that.
sbi
sbi
Any good example you can think of?
... Nope, nope not really.
sbi
sbi
Ha. I looked at recent code of mine. The only MI I found was when I was inheriting from some base class and boost::noncopyable.
Not really a good example.
Meh. They all use this.
What's wrong with operator overloading?
Also I've only used MI once.
sbi
sbi
Haha! class Pegasus : public Horse, public Bird {...}; That's a funny one!
07:18
Do that one!
sbi
sbi
@Rapptz It's overused.
In what sense? o.o
template <class BaseOperator>
struct OperatorCarry: public BaseOperator, public Carry {..};
I don't see a problem as long as it doesn't do anything retarded, i.e. change the meaning of the operator
sbi
sbi
This is another one of those theoretical examples from the era of OO when we all tried to model the world using deep inheritance hierarchies.
@Rapptz Read rule no. 1 here.
(Come up with one good example of operator overloading that's not containers or smart pointers.)
@Rapptz Uh. What's that mean? "Carry"?
24 - 9 is 13, or 9 with 4 carry.
sbi
sbi
I must be dense.
07:22
In elementary arithmetic a carry is a digit that is transferred from one column of digits to another column of more significant digits during a calculation algorithm. When used in subtraction the operation is called a borrow. It is a central part of traditional mathematics, but is often omitted from curricula based on reform mathematics, which do not emphasize any specific method to find a correct answer. Manual arithmetic A typical example of carry is in the following pencil-and-paper addition: ¹ 27 + 59 ---- 86 7 + 9 = 16, and the digit 1 is the carry. The opposite is a bo...
sbi
sbi
Why do I keep hitting Java sides when looking for examples of MI in C++?
@sbi lol
sbi
sbi
@Rapptz Ah, that. Uh. Should've thought if it. Um.
@Mysticial They seem to have C++ tutorials!
@sbi A numeric class, um.. a matrix class. A vector class.
Unless those count as containers (do they?)
sbi
sbi
@Rapptz Can you elaborate?
07:24
Hm? Which part?
sbi
sbi
@Rapptz What derives from what and why?
Oh did you reply to the wrong thing, I thought we were talking about operator overloading.
bitbucket.org/Rapptz/gears/src/… is where I got it from
sbi
sbi
OMG. The C++ FAQ actually uses NuclearPoweredWaterVehicle as an example for MI.
lol
sbi
sbi
07:27
@Rapptz Oh. Operator overloading was just a sidekick sparked by an offhand remark by me.
Why don't they just call it a Nuclear sub?
Or do they actually make nuclear powered ships.
sbi
sbi
@Mysticial Why didn't they just call it a day and tried to find a good example the next morning?
@sbi That's a good question.
Maybe they were drunk from digesting too much C++?
@Mysticial Yeah, not many of them though. (I remember a former Soviet icebreaker.) Still, you can use a type synonym!
sbi
sbi
Damn, and AmphibiousVehicle. I have been seeing that for teaching the usefulness of MI since the early 90s.
Ok, I give in. I think I go for the classic shape example. Any hints for a good twist on this?
07:31
To make it MI?
sbi
sbi
@Mysticial Yep. And no abstract base classes. They come in the next step.
Wait... wouldn't Shape already be an abstract base class?
sbi
sbi
@Mysticial Yes. That's why I am not using it yet.
class filled_rect : public rect, public colored {...};
Anyone a better idea?
How about quadrilateral. With squares, rectangles, trapezoid... etc.
Then add a Shape abstract base class later on along with triangles, pentagons, etc...
sbi
sbi
16 mins ago, by sbi
This is another one of those theoretical examples from the era of OO when we all tried to model the world using deep inheritance hierarchies.
Sigh. Basically I am using just that anyway.
class colored {
public:
  colored(color c) : col(c) {}

  color get_color() const {return col;}
private:
  color col;
};

class rect : public shape {
public:
  rect(const point& ul, const point& lr);
  // ...
};

class filled_rect : public rect, public colored {
public:
  filled_rect(const point& ul, const point& lr, color c)
  : rect(ul,lr), colored(c)
  {}
  // ...
};
07:38
How about: Humans
- male, female, somewhere in between.
- morons

Somebody can be both a male and a moron.
</tongue-in-cheek>
sbi
sbi
@Mysticial One of the most prominent ones of the 90s deep inheritance hierarchy era is the employee-secretary-external_consultant one...
So why not use that? Or is it the problem with the abstract base class?
sbi
sbi
@Mysticial maybe it's just me having been tortured with those examples for 20 years.
And, yeah, employee certainly ought to be an ABC.
I can't think of any examples that aren't too technical.
user1357851
Person *newb = new Person();
user1357851
07:49
if(newb->EnterLounge() == true)
user1357851
{
user1357851
newb->troll();
user1357851
}
sbi
sbi
@Mysticial Tehy're doing embedded stuff, so you'd think they can deal with technical examples. But I have been burnt by that assumption before. :(
I had an example involving planets and stars. But it turns out to be a weak example.
Or rather one that doesn't work...
sbi
sbi
07:59
They all are weak examples. Maybe we should ban MI except for interface MI with ABCs. :-/
user1357851
anyone here knows linux well?
user1357851
Ubantu + wordpress more exactly
09:04
Pope Saint Hilarius (also Hilarus, Hilary) was Pope of the Roman Catholic Church from 461 to 28 February 468. He was canonized as a saint after his death. The Sardinian archdeacon of Rome, Hilarius was elected bishop of Rome, probably on 17 November 461, and was consecrated on 19 November 461. As archdeacon under Pope Leo I, he fought vigorously for the rights of the Roman See and vigorously opposed the condemnation of Flavian of Constantinople at the Second Council of Ephesus in 449 to settle the question of Eutyches. According to a letter to the Empress Pulcheria collected among the...
 
1 hour later…
10:23
@shI you leave MI alone!
sbi
sbi
Who is @shI?
user142019
Your typo'ed uncle.
sbi
sbi
He ain't my sibling, bro'.
10:39
@sbi crap damn it :P was on my phone for that one
sbi
sbi
@thecoshman I don't believe a word you say.
@sbi o_0 ok then...
YES! Kerbal Space Program now has native Linux version!
sbi
sbi
It's about time, now that the NASA Space Program died.
is... is that a joke?
sbi
sbi
How would I know? I have no idea what the "Kerbal Space Program" is supposed to be.
10:45
it's an awesome game is what it is :D
you get to build and fly space ships and what not.
Nice balance between realistic simulation, and playabally fun
I'm hungry
user1357851
user142019
I'm hungry
I'm hungry. I have cheese. Soon. I will not be hungry.
user142019
user142019
11:07
If this gets fifty stars, I'll quit the lounge forever.
obvious starbait is fail
also, we don't have enough regulars to get fifty even if we all fell for it
user1357851
unless it's sticky
still no
user1357851
38 votes for We're officially the best room ever - mar 13 at 6:03 by Cat Plus Plus
user1357851
close ...
11:09
it's not really close
sbi
sbi
Students exploiting professors wrong game theory assumptions about their non-cooperativeness (via @andreasdotorg) http://www.insidehighered.com/news/2013/02/12/students-boycott-final-challenge-professors-grading-policy-and-get
> Despite awarding As to all the students who participated in the boycott, the experience has led Fröhlich to alter his long-held grading policy.
LOL!
well played to those students
sbi
sbi
When I was teaching C++, I kept considering whether I shouldn't employ a similar scheme: use the highest achievement as passed with 100%, and the lowest as failed, and take grading from there. However, it was exactly the fear of awkward gradings resulting from statistical oddities that made me work hard enough to be confident with having an absolute 100%, rather than a relative one.
user1357851
sbi
sbi
Of course, as a teacher I would have looked bad when none of the students had gotten passed 75%. But then I would have looked just as bad had I made this the new 100%.
user1357851
11:39
toss the dice, the highest should be between 81-95
user1357851
but that's as arbituary as the number of people in this lounge at any given time

« first day (883 days earlier)      last day (4291 days later) »