« first day (653 days earlier)      last day (4301 days later) » 

9:00 PM
Hey, does anyone know if there are still good reasons to advocate usage of mainframes in new businesses which e.g. are sure to be hard on transactions later on? Think something like PayPal.
Or are they only still produced to keep compatibility with legacy businesses like banks and stuff?
 
Who cares about C++03 compatibility when you're dealing with auto?
 
@R.MartinhoFernandes That was my point..
 
Yo momma.
 
Nice fish.
 
9:08 PM
Looks derpy.
 
For std::vector, .size() or iterators?
 
Iterators are magic.
 
Iterators.
 
Why?
Vectors are guaranteed to be sequential, right?
 
contiguous memory...?
 
9:11 PM
Because the interesting part of the code is not the logic to iterate.
 
@Tocs I mean, .at(1) .at(2) ....
 
Imagine two workers:
One knows exactly what he needs to do, so you can actually concentrate on your work.

The second one can do his work, but needs you to hold his hand and do the boilerplate, hampering your actual work that you're trying to do.
 
@Drise Don't use at.
 
@DomagojPandža That's a very lousy non-metaphor lol.
I'm not sure what the workers bring when you can just say 'boilerplate hampers readability'.
 
Well, that didn't pan out too well.
 
9:13 PM
@EtiennedeMartel What are you supposed to use to get an element at an index? Isn't at() the same as the [] operator?
 
@Tocs I believe at does range checking. [] does not. Which means you can corrupt your heap.
 
One gives you a hammer and a nail, the second nails it down for you.
 
@Tocs at checks for bounds. As such, it's slower.
 
Oh, interesting
http://i.imgur.com/ZrpWR.gif
 
@EtiennedeMartel No way it's slower. Why wouldn't it just check != vector.end()?
 
9:16 PM
@Drise It's a check. Of course it's slower than no check at all.
 
Because it accepts an index as argument. v.end() is an iterator. More seriously though, any kind of check takes more resources than not doing a check at all.
 
@LucDanton Well, yea.
 
1
Q: If and elif are not printing

Edward LaPiereprint'Personal information, journal and more to come' x = raw_input() if x ==("Personal Information"): # wont print print' Edward , Height: 5,10 , EYES: brown , STATE: IL TOWN: , SS:' elif x ==("Journal"): # wont print read = open('C:\\python\\foo.txt' , 'r') name = read.readline() print ...

Dat indentation. -_-
 
@Drise It is still a check and as such - it must be slower.
 
lol
 
9:18 PM
@RadekSlupik Dafuq?
 
Wait, does POD pod; perform initialization or not?
 
His coding style is the opposite from PEP 8.
PEP 1/8
 
@R.MartinhoFernandes Never understood POD's...
 
@R.MartinhoFernandes no.
 
@R.MartinhoFernandes No.
 
9:19 PM
@LucDanton What's it called? default-init?
 
I think so.
 
error: request for member 'DisplayData' in '* itConnections.__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator-> [with _Iterator = DisplayDevice**, _Container = std::vector<DisplayDevice*>, __gnu_cxx::__normal_iterator<_Iterator, _Container>::pointer = DisplayDevice**]()', which is of non-class type 'DisplayDevice*'
 
Nice error.
 
Argh, I know I have the right answer, but I realized I have the wrong GSQs.
 
Dafuq is it trying to tell me?
 
9:22 PM
Use ->.
 
I am.
itConnections->DisplayData(packet);
 
It tells you that your code is wrong.
 
Ah, use one more.
(*itConnections)->...
 
@LucDanton Green build... So what, I need to dereference the iterator first to get the vector?
 
@Drise it says it right there: _Container = std::vector<DisplayDevice*>
 
9:24 PM
@Drise I don't know, I'm just following the error message.
 
Templates generate the worst error messages.
 
I hate error messages that just say random crap when all you've done is missed a deliminator
 
@KianMayne I love the pages and pages if you miss a ;
 
It would help if you gave us a snippet of the code that references itConnections etc.
 
  for (auto itSensor = sensors.begin(); itSensor != sensors.end(); itSensor++)
  {
    DataPacket packet;
    packet.SetData(itSensor->second->GetData());
    packet.SetID(itSensor->second->GetID());
    packet.SetMaterial(itSensor->second->GetMaterial());
    packet.SetType(itSensor->second->GetType());
    packet.SetUnits(itSensor->second->GetUnits());

    for (auto itConnections = connections[itSensor->first].begin(); itConnections != connections[itSensor->first].end(); itConnections++)
      (*itConnections)->DisplayData(packet);
 
9:27 PM
@Drise Yeah. I don't really get them any more, it's usually "Unexpected ;" when I'm writing stuff in other languages
 
Dereferencing the iterator returns a reference to what the iterator holds, which in your case is the pointer to the Connection you can't use the -> operator directly on the iterator because the pointer doesn't have member functions. Or atleast that's how I think about it
it->func() would be the same as ptr.func() which will not fly.
 
@Tocs Fair enough.
@Tocs Btw, Welcome to the Lounge.
 
How can I get Mercurial to list all the files that were committed in a particular chageset
 
I usually do something like
for (auto i = blah.begin(); i != blah.end(); ++i)
{
(*i).whatever(); //or (*i)->whatever();
}

Thanks!
 
Thanks for this comment. I am new to Stackoverflow, and didn't really understand why I received so many downvotes. Thanks! (I've read the answers for other questions several times, but I am new to actually answering) — Daniel Fleischman 5 mins ago
I feel I should flag this for being too chatty.
@Prætorian Via commandline, or in Tortoise?
 
9:32 PM
@Drise I feel like I've seen your username before, do you bum around the GDnet IRC occasionally?
 
We may have a winner here:stackoverflow.com/a/11729920/868546
@Tocs I bum everywhere. I dunno what GDnet is, but I do pilfer IRC.
 
lol
 
@Drise Why did he mention non-explicit copy constructor?
 
@n2liquid I dunno, this is way out of my knowledge scope.
 
error: no member named 'iota' in namespace 'std' ?????????
 
9:35 PM
@Drise As Tocs said, dereferencing an iterator returns the given element. And that element should be a DisplayData*, which should be accessible by ->. There must be something more hidden behind those autos
 
@Tocs I've participated in Minecraft server hosting, Bitcoins, SO. People even call me Drise irl.
 
@KeithLayne C++11 only.
 
@Drise GameDev.net, the game development portal, quite popular. Same as Gamasutra, little less professional.
 
@KeithLayne #include<numeric> ?
 
std::map<int, std::vector<DisplayDevice*> > connections;
std::map<int, GenericSensor*> sensors;
 
9:36 PM
@Tocs did that
@LucDanton -std=c++11
 
@KeithLayne Yeah, but you have to check the version and the docs, too.
 
Dafuq
I hate markdown.
 
reStructuredText > Markdown
 
Hmm maybe I saw you in minecraft then, your name is still familiar
 
@Tocs Undercraft sound familiar?
 
9:38 PM
@Drise nope :/
 
Übergeekkiller?
 
@KeithLayne Missing includes?
 
Was my minecraft server for a year or so. Till I decided that my server was too loud in my room and pulled the plug.
 
FYI, iota is not in <algorithm>, but in <numeric>.
 
Note: Don't run a server in your room.
 
9:39 PM
If I've got a C++11 ranged for loop for (auto i : myCollection), and myCollection has both iterators and const_iterators, and myCollection itself is not const but I want to make sure that this for loop uses const_iterators... is there an elegant one-liner to do that?
 
@Drise Command line
 
const auto &temp = myCollection; for (auto i : temp) doesn't really count as elegant.
 
@R.MartinhoFernandes FYI, I know that :)
 
Can't you put const auto i?
 
@Prætorian I would say svn diff <version> but I've used too much svn and not enough Hg lately.
 
9:40 PM
You can, but that doesn't force the lookup of begin and end to use the const versions.
 
@Quuxplusone You can write a function like template <typename T> T const&& as_const(T&& t) { return std::forward<T const>(t); }.
 
That just makes it so you can't modify the value of i inside the loop.
@R.MartinhoFernandes If that were already in the standard library somewhere, I guess that would count.
 
Oh dear that's correct my bad
 
@Quuxplusone I'd just use a regular for loop
 
CV-qualifier propagation for the win.
 
9:41 PM
@Drise no markdown on multiline
 
This is going to suck big time.
 
@Drise That kinda works. I was hoping for a simple list of file names but hg diff -r8 prints diffs of all files that changed in rev 8
 
		bool getSensorData(char *type, char *material, int *ID,
			char *units, double *minVal, double *maxVal);
		bool getDisplayData(char *type, int *IDs, int *IDCount);
 
@R.MartinhoFernandes Version won't work as is.
 
@Drise I don't like the looks of char* type, char* material. Those should be class types I think
 
9:42 PM
How does T const&& collapse for T = U&? U&, no?
 
@MooingDuck I don't either. Just std::strings
 
@Drise and why are minVal/maxVal pointers?
 
@MooingDuck He should be using double&
 
A& & becomes A&
A& && becomes A&
A&& & becomes A&
A&& && becomes A&&
 
@Drise are they modified?
 
9:43 PM
@LucDanton Hmm, I think it's U const&.
 
@Tocs That's no help.
 
I was wondering if std::add_const would be relevant. I don't think it is, but now I have a question: what's the point of using add_const<T>::type over const T? Seems like they're equivalent in all cases.
 
@LucDanton const changes it?
 
Program one. He provides the data reader.
 
9:44 PM
what's the g++/clang switch to show includes and such?
 
@KeithLayne -H
 
thanks
 
This is going to suck so hard.
 
Man, I'd check that const thing but streams can't wait.
 
@LucDanton Hmm, actually, there seems to be a problem to be for T = U.
 
9:46 PM
Guys can I ask you for advice ?
 
No, wait, there isn't.
That problem is with my test. Duh.
 
@Drise oh, pft, homework. It's easiest just to do it their way, and forget about it. If you're ambitious, make a proper wrapper.
 
@nikola no
 
@NikolaNinkovic you could, but we may or may not give a useful answer
 
@MooingDuck This isn't some simple homework.. Well, this is the most complex homework I've ever done.
Next I have to implement Observer, Abstract Factory, and Singleton.
 
9:47 PM
Ah, fsck.
 
ack, it's like the experimental whatever #define is not happening, because it's looking in the right header, and iota is in there.
 
@LucDanton You were right. :(
 
And I have to write a binary tree and 5 sorting algorithms. and do all the documentation. And do it by wednesday 11:59.
 
Whatever, just use: template <typename T> T const& as_const(T const& t) { return t; } :P
 
I would ask for some help from here, but I know better.
 
9:49 PM
Who needs const rvalue refs anyway.
 
@MooingDuck I just want to ask to give me link to some open source project for begginers like me (1 year expirience in C/C++)
 
@NikolaNinkovic that's not really enough experience for anyone to let you into an open source.
 
Jul 14 at 5:58, by Domagoj Pandža
Hello. C write I. Me no know English but good programmer very.
 
@R.MartinhoFernandes I think the last time we discussed this you ended convinced that this behavior is preferable than e.g. const propagating to the referee.
 
@NikolaNinkovic except for unofficial useless stuff, like schools
 
9:50 PM
@LucDanton I think I remember that.
 
Did @DomagojPandža go quiet?
 
@MooingDuck It's not like he can break anything.
 
@Drise you're professor wrote that code? That's terrible. That's C with classes!
 
The worst that can happen is getting patches rejected.
 
@MooingDuck Don't remind me.... please spare me.
 
9:51 PM
@Drise inFile = new ifstream();
 
@NikolaNinkovic Try small pull requests on GitHub. Fork stuff, fix small things that you feel comfortable with, and make pull requests. You can find tasks in the projects' open issues list.
 
@Drise I'm working on stochastic light transport for my raytracer. The math got me entangled, I just fucking love probability!
 
@MooingDuck It would really like a new parser if you're game, but I am not asking.
 
@MooingDuck Don’t professors always write bad code?
 
9:52 PM
@DomagojPandža I just really like your quote I posted above. It's in my sandbox.
 
@RadekSlupik it doesn't even get deleted!
 
@MooingDuck Oh lord.
 
Dr. Rick Coleman
 
@MooingDuck Okay thanks for help
 
I know who to kill thursday.
 
9:53 PM
@RadekSlupik we must find him and get him fired
 
@RadekSlupik Er.. Wait till thursday. Unless him getting fired means I get an A
 
@n2liquid I will find something less complex, tahks You too
 
@Drise if he's dead, you don't have to turn in the homework
 
@NikolaNinkovic Just pick an open-source project you already know and use, check their bug tracker and find some easy bugs to start.
 
Write the homework in top-notch C++11.
And watch his reaction and probable downvote.
 
9:53 PM
@RadekSlupik I'm trying, but must compile with VS2010
 
What an asshole. Afraid of new technologies.
 
@Drise I think this guy (stackoverflow.com/a/11729920/180581) covered the most of what you asked. You might as well accept his answer. Is something not making sense to you still?
 
Oh wait.
It must compile with VS2010?
 
@RadekSlupik He doesn't even know 11 exsists.
 
Can’t you use VS2010 with GCC?
or clang
 
9:54 PM
@Drise Technically, it doesn't exist yet.
 
@n2liquid No, I was waiting for one of the lounge regulars to chime in if they had anything. Possibly a Standard quote.
 
Jul 26 at 21:30, by R. Martinho Fernandes
@Insilico There are few problems that can't be solved by finding the right people and shooting them.
 
@R.MartinhoFernandes Ox
 
@Drise Hahahaha :P
 
@Drise please invite him here and we will teach him proper C++.
 
9:55 PM
I won't.
 
Me neither. xD
 
@n2liquid its common to wait at least 24 hours to accept an answer, so all timezones have a chance
 
@MooingDuck You're serious?
 
I asked him "Are we allowed to use any of the new C++11 features?" His response: "I don't know what you are talking about. Next?"
 
its typeid().name() supposed to return something useful...
http://ideone.com/BPq9g
 
9:56 PM
@Drise LOL
 
bam! email: rcoleman@cs.uah.edu
@n2liquid yes
 
@Drise “You don’t know what I’m talking about? I don’t know why you still work here.”
 
@MooingDuck I always accept as soon as I realize the answer covered everything and I could validate it.
 
@MooingDuck I saw that one before. It was linked here.
 
@MooingDuck Moar like the best page ever!!! (to make fun of)
 
9:57 PM
@Drise is the zip on the class website somewhere, so I don't even have to admit to seeing it though some anonymous student?
 
The formalization of 0x into the C++11 standard basically rendered 99% professors of software engineering outdated and useless.
 
@MooingDuck You're e-mailing him?
 
Xeo
1
A: template metaprogramming: (trait for?) dissecting a specified template into types T<T2,T3 N,T4, ...>

Johan LundbergThis is a self answer I came up with as a variant of the answer from Kerrek SB. It is possible to make a trait that extracts std::vector from std::vector<int> and exposes it as ::type via a trait. Yes, this solution is nearly identical to Kerrek's, but to me the use syntax is more aestheti...

 
O balls.
 
9:58 PM
@R.MartinhoFernandes maybe
 
@DomagojPandža You mean 99% of the 1% that weren't already outdated and useless?
2
 
Xeo
You will need ::template for aliases, right? :/
 
nah :P
 
@RadekSlupik How mature.
 
9:58 PM
@R.MartinhoFernandes That is so true it hurts.
 
@RadekSlupik Yeah :(
 
@MooingDuck I linked the above.
 
Let's all greet that professor with an email.
 
Hey atleast your professors acknowledge C++ as a language
 
9:59 PM
@DomagojPandža WTF, this is not 4chan.
 
You guys are too good, rofl.
 

« first day (653 days earlier)      last day (4301 days later) »