« first day (856 days earlier)      last day (4085 days later) » 

12:00 PM
Hah. Well, it wasn't that stupid, if there's boost for it
 
Xeo
@FredOverflow That question sucks.
The duplicate is better.
 
Hi there ppl.
 
Xeo
13
A: Platform independent /dev/null in c++

XeoEdit: Taken from @Johannes Schaub - litb's mail here with slight modifications: template<typename Ch, typename Traits = std::char_traits<Ch> > struct basic_nullbuf : std::basic_streambuf<Ch, Traits> { typedef std::basic_streambuf<Ch, Traits> base_type; typedef t...

:3
 
How do you replace all characters in a string?
string::replace(filename.begin(),filename.end(),'\\','/');
 
Xeo
std::ostream nullout(nullptr); :)
 
12:01 PM
This is what I am trying to do
 
@BartekBanachewicz Have they released boost::income and boost::confidence yet?
 
but it is saying it cannot find replace.
 
Xeo
@Dreamer78692 replace is a member function. Go figure.
 
@Xeo <sub>metawankery</sub> Oh, that's great!
 
Also boost::filesystem::path.
 
Xeo
12:02 PM
Also, search SO.
 
user142019
std::ofstream stream("/dev/null"); // and forget about inferior operating systems
 
Xeo
And what the robot says.
 
@Dreamer78692 You need to call member functions on objects, not classes.
 
Xeo
@Zoidberg I think I'll also forget about inferior forms of life, like lobsters.
 
user142019
12:03 PM
I'm just a human with an avatar and a nickname so I don't really care.
 
boost::onullstream works perfectly, i.e. it doesn't work
 
Xeo
@FredOverflow Everytime I google for boost::irange, I get suggestions about boost::orange. :(
 
@Zoidberg Do you have Windows around?
 
user142019
Yes.
 
But you probably want the std algorithm:
 
user142019
12:04 PM
I'm using it right now.
 
std::replace(filename.begin(), filename.end(), '\\', '/');
 
@Zoidberg Try creating a file named nul.
 
user142019
I know what NUL is.
 
Note the std:: instead of string::
 
@FredOverflow dude. he is supposed to learn
 
user142019
12:04 PM
I used it when experimenting with machine code.
 
user142019
as -o NUL etc...
 
I tried std::
 
@Dreamer78692 did you google?
 
@BartekBanachewicz alright, I think I mostly have everything now. I've gotta go right now but I'll see if I can get cmake/gcc to build this later.
 
12:06 PM
@BartekBanachewicz looks pretty cool so far
 
@doug65536 sure. Maybe I'll fix some problems with build in the meantime
 
it says std is not a member of std?
 
@doug65536 thanks :)
@Dreamer78692 included everything?
 
Yup.
#include<cstring>
 
@Dreamer78692 no
that's C string
you want C++ string
#include <string>
 
12:08 PM
I also have #include <string>
and #include <string>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
 
well, don't just put random includes there -.-
 
user142019
You have to import Data.String and import Data.Char.
 
only <string> is C++ standard
@Dreamer78692 do you have using namespace std;?
 
yup.
 
remove it
 
user142019
12:09 PM
lol using namespace std;
 
user142019
lolololol noob
 
then i have to use std:: everywhere
 
no
qualify individual names
using std::string;
 
@Zoidberg hey, let's be nice, mkay? :)
 
user142019
@Dreamer78692 yes.
 
user142019
12:09 PM
That's good.
 
using std::replace;
 
user142019
You want that.
 
user142019
Otherwise everything will fuck up.
 
And don't listen to the lobster, he can't C++ and is just trolling you
 
user142019
Never ever do using namespace whatever; except in small scopes that you don't export.
 
12:10 PM
although that ^ is right
I still prefer explicit qualification
 
user142019
using namespace std::placeholders; for example is fine if you do it in a function body.
 
Is there an easier way, to do this... what you mean by qualify individual names
 
@Dreamer78692 you don't have to, as @BartekBanachewicz said, but honestly, I much prefer using the std:: prefix. It doesn't take much time to type (and my typing speed isn't the bottleneck when I'm coding anyway), and it makes the code easier to read
 
user142019
It's the easiest way.
 
user142019
std::string very_easy;
 
12:12 PM
because I know that when I see std::vector, it is the standard library vector, and not some other weird vector from some library you imported
 
user142019
191
Q: Why is 'using namespace std;' considered a bad practice in C++?

ManaI've been told by others on numerous occasions that my teacher was wrong in saying that we should have using namespace std; in our programs, and that std::cout and std::cin are more proper. However, they would always be vague as to why this is a bad practice. Why is `using namespace std;' consid...

 
it allows me to easily, at a glance, see whether a type comes from the standard library or not. I find that useful
 
I tend to strip glm:: from my code, but it's very clear that I'm using it. Got it?
 
@Dreamer78692 exactly what he showed above. You can do using std::vector to import vector, and nothing else, into the global namespace. Then you can refer to that without std::. So you control exactly what gets to pollute the global namespace, and what doesn't
 
user142019
Time to feed myself.
 
user142019
12:14 PM
brb
 
user1182183
@BartekBanachewicz I guess I have to use std::map ? hm is there a container for a type I want which can return unique ID's to manage the data? Like: container.push(MyStructure); and it returns an unique ID which won't change when other elements are removed?
 
@GamErix it's called hashing
 
user1182183
@BartekBanachewicz I guess I have to use std::map?
 
@GamErix no.
 
user1182183
and how am I going to hash a struct..
 
12:16 PM
Thanks people.. it works now.
 
whether std::map hashes or not is implementation defined
@GamErix is it POD?
@Dreamer78692 always there to help :)
 
user1182183
just struct name int int int;
 
@GamErix I'll ask again
is it POD?
Do you have any pointers or std::string or whatnot inside?
 
user1182183
@BartekBanachewicz you mean "A Plain Old Data Structure in C++ is an aggregate class that contains only PODS as members, has no user-defined destructor, no user-defined copy assignment operator, and no nonstatic members of pointer-to-member type." ?
 
@GamErix yes.
 
12:18 PM
@GamErix You mean, like, a pointer?
 
user1182183
it has no user defined constructors, destructors, etc
 
user1182183
@DeadMG don't pointers change in a vector?
 
@GamErix so you can just hash it like any other data
 
yes, but vector != all containers.
 
user1182183
@DeadMG and in which container pointers don't change? ; o
 
user1182183
12:19 PM
when removing, adding elements, etc
 
@GamErix why don't you read the standard about that?
 
user1182183
okay.
 
user142019
Hi.
 
@GamErix anyway, if you give me full use-case, I'll be able to tell you if it's ok to use plain hashing
 
user142019
I have bread with chicken and letuce and egg and tomato.
 
12:20 PM
You know what hashing is, right?
 
user1182183
yes I know
 
user142019
Lies.
 
user1182183
well what I want to do is create a container where I can insert and remove elements, but each element needs it's own ID because it needs to be referenced in the future, for eg changing the color of the background in that certain element. or any other variable in it
 
Ell
Bartek I found out what nubbery was causing it not to build
I didn't build engine xD
 
hmm
 
user142019
12:22 PM
hmm?
 
my parents decided to start charging me rent
 
user142019
@DeadMG suckx
 
not really
they spent all their money on renovations and extensions
 
user1182183
because the script just does something like "var x = CreateSomethingNew(data);//returns ID" and then sometimes it needs to remove data like RemoveData(x); and change data like SetVariable(x,1,1,1); etc
 
12:23 PM
@GamErix map would be the easiest then. Why can't you use it?
 
user142019
@DeadMG doesn't suck
 
@GamErix For a script, that's a completely different thing.
 
Ell
I really need to fix my internet
 
why not just use an index into a vector or whatever.
the script doesn't need to see the actual type.
 
@DeadMG makes sense
 
user142019
12:23 PM
@Ell s/my/the/ FTFY pun intended
 
user1182183
@BartekBanachewicz I can, just, the best way to ensure a id is to make a global and increment it by one and make that the key?
 
@sehe I agree.
 
@GamErix can be, why not. Or use GUIDs
 
user1182183
hm oki
 
@GamErix Why not use an index into a vector or deque?
there's no reason to use a global just because you want to refer to something later.
hell, even a pointer into a linked list would be better than a global
 
12:25 PM
@Ell it should fail at link, right?
 
user142019
I don't see why deque is called deque.
 
user1182183
@BartekBanachewicz can't really save guids into a 4 byte variable
 
@Zoidberg double ended queue
 
@Zoidberg double-ended queue
 
@GamErix make a bigger variable sigh.
 
user142019
12:25 PM
Sherlock.
 
user142019
But why.
 
... because it's a queue with two ends.
 
@Zoidberg oh goddamit
 
user1182183
@BartekBanachewicz my pawn is compiled for only 32 bit variables
 
user1182183
;>
 
12:25 PM
@GamErix then GTFO. I told you numerous times to not use it.
 
user142019
I more like a linked list of arrays.
 
Ell
I still don't understand the problem
 
@Zoidberg Implementation detail.
 
user142019
Oh. :P
 
also, it's an array of arrays.
 
Ell
12:27 PM
@bartek missing header files too, I'm such a dingus.
ill try again when I get home
 
@Ell Did I mention raycasting works? :3
 
user142019
@DeadMG Oh. :P
 
user142019
Ray tracing is better.
 
Ell
Awesome :D
 
user142019
Sacrifice performance.
 
12:28 PM
I know, right?
you can mine now
 
Ell
Is raycasting done in CPU?
or gpu?
 
ATM, CPU
 
user142019
Implementation-defined.
 
works fast enough anyway
 
Ell
Cool
 
12:29 PM
I had some serious eeks with floating point numbers, but fixed it this morning
Hmm
I now wonder, because I have two options
 
Ell
Was that the increasing z by 1?
 
either return all hit cubes
or pass the lambda that will be executed on every cube
 
a CPU implementation would be impossibly slow
it would have to be GPU.
 
Sigh it's just for mining.
 
Ell
Or both?
 
12:30 PM
BUT YEAH YOU DON'T LISTEN TO ME, RIGHT? :(
 
most of the work would be GPU-side.
 
Ell
But if it was on gpu then I guess the lambda thing wouldn't be possible?
Oh just fo mining
 
what lambda thing?
 
Ell, please forward the shouted message
maybe he will change his mind :(
I hate it.
 
Ell
@deadmg passing a lambda which will be executed for each cube hit - would that be possible on the gpu? But now I realise just the raycasting Would be gpu and the lambda still CPU so ignore me
 
12:37 PM
"Whence" and "whither" are my new friends.
 
I feel thrown away.
It makes me sad.
I'll return the vector for now.
 
10 days to review gold badge!
@R.MartinhoFernandes Just don't abuse "whence"!
I guess "whither" doesn't tend to get abused in the same way because no-one knows about it
 
imgur
yesterday
 
what?
 
12:46 PM
good question
 
excellent
 
1018: In Poland, adulterous men have their scrotums nailed to a public bridge - and are given a sharp knife to free themselves. [Thietmar]
 
yea, just in
My roommate, who happens to be history fanatic, says it can actually be true
 
it "can" be true?
 
it doesn't seem surprising to me
society reacted rationally to crimes back in those days
 
12:48 PM
is that different from actually being true?
 
before the liberal movement came and softened everyone up, causing the current mess of immorality and crime
 
well, in one scenario, it actually happened, and in another, it didn't
so I'd suggest that yes, they are different.
 
@DeadMG no; in one scenario, it actually happened, and in another, whether it happened or not is not stated
 
@LightnessRacesinOrbit You mean how most crimes have been declining every year for about the last 20?
 
@DeadMG but if it didn't happen, then how "can" it be true?
 
12:49 PM
@DeadMG they went up a lot first
 
and if it did happen, then the fact that it can be true isn't very relevant, because it's kind of overshadowed by the fact that it actually is true
 
also it's debateable whether crimes have actually been declining or whether reporting figures have gone down, since the margins are so tiny
 
i just wouldn't get too attached to those gov-reported crime figures "omg 2% fewer burglaries in 2012"
 
You hate me, or you can hate me? :D
 
12:50 PM
it doesn't really tell you anything
 
It's probable, you fuckwits.
 
although I guess it makes more sense there. It's possible to be capable of hating someone without actually hating them, I guess
 
@jalf Yes. I am capable of hating each and every one of you, but I only actually hate around 90%
 
Obviously we should make all crimes punishable by death
 
12:51 PM
because you're
yes!
that'll take care of the chav problem pretty quickly.
 
@CatPlusPlus I agree. These terrible persons should learn their mistakes.
 
Don't say persons it's weird
 
It is correct, IIRC
 
it's been years since I heard anything about any chav problem.
 
also, in this context, I think more appropriate
 
12:52 PM
2003 called; they want their prejudices back.
 
It's still weird
 
@LightnessRacesinOrbit you seem to like those words eh?
 
@CatPlusPlus like most of the things in this room
 
@TonyTheLion perhaps you forget the context of them
@TonyTheLion they are lounge words
 
@LightnessRacesinOrbit huh?
what am I missing?
 
12:53 PM
@DeadMG um, are you kidding me? have you been into a British city lately?
 
yes
 
I deal with the "chav problem" on a daily basis, and so does absolutely everybody I know
perhaps you're blind.
 
perhaps you're massively overstating it.
 
perhaps you're wrong
 
perhaps you're wrong
 
12:55 PM
We have a particularly bad time in this appt block; the car park shutters are vandalised three/four times a week (and I'm not exagerrating; really) and then the chavs come in to smoke their weed and steal cars
 
perhaps you suck
 
your anecdotal experience does not make for any sort of argument in favour of a national chav problem.
 
fortunately CCTV which includes the ability to actually make out faces is going up soon.
 
I don't have chav problems, mainly because I live in a shithole
 
@DeadMG no, but neither does your anecdotal experience of being blind make for any sort of argument against it
 
12:55 PM
@DeadMG > national chav problem - lulz
 
@DeadMG but I happen to have the truth on my side, so I win!
 
Thanks for reminding me why I had the guy on /ignore. And for reminding me how hateful and prejudiced some people are
 
you're both chavs, your arguments are invalid
 
seriously though, come spend a day in my city. then spend a day in the neighbouring city. then spend a day in Bristol, or Gloucester, or Birmingham
 
@jalf which guy?
 
12:56 PM
or pretty much anywhere that you don't live
omg Newcastle
 
I did spend a few days in Bristol recently.
 
and even in London.
 
Sadly, chav-hunting is now banned, plus shotgun shells were getting expensive anyway.
 
you can barely walk down the street without some thug spitting on the pavement where you walk
 
12:57 PM
lulz
 
@TonyTheLion LightnessRacesinOrbit
 
@LightnessRacesinOrbit my word, exaggeration much?
@jalf that's not a bad suggestion
 
@TonyTheLion No, not at all.
 
@LightnessRacesinOrbit last time I had chav problems was 10 years ago
 
@TonyTheLion Everywhere you go, people are spitting on the streets like it's some kind of okay thing to do. It's like they lack the ability to swallow saliva.
@TonyTheLion Where are you, roughly?
 
12:58 PM
@LightnessRacesinOrbit generalities much?
 
@TonyTheLion No, not at all.
 
@TonyTheLion is... that a trick question?
 
@TonyTheLion Did you use traps or poison?
 
lol
 
@jalf no
 
12:59 PM
I am sat here telling you that not a day goes by when I do not see that. You don't have to believe it, but that is the case.
 
spitting on the street isn't even against the law.
 
Perhaps you live in some posh area
@DeadMG so? It's disgusting. it's what chavs do
 
except in that one random council where they just put up penalty fines.
 
no, I live in a shithole, as in, nothing ever happens here
 

« first day (856 days earlier)      last day (4085 days later) »