« first day (561 days earlier)      last day (4386 days later) » 

11:01 AM
hmm
can I define a friend function of a class template inline?
it doesn’t seem to work
 
Yes, you can.
friend void foo() { std::cout << "bar\n"; }
 
that’s boring … I need to pass a parameter
the following doesn’t work:
template <typename T>
struct ptr {
    template <typename U>
    friend std::ostream& operator <<(std::ostream& out, ptr<U> value) {
        return out << value.value;
    }
};
And it doesn’t work without the template <typename U> either …
It does work when I define it outside of the class
… or not
 
that looks valid
 
yes, the problem is somewhere in catch.hpp
ambiguous overload
grr, ok, why is Catch complaining then?!
 
FTR why not define the friend as a non-template taking ptr?
 
11:09 AM
Will std::cout convert \n to \r\n for me?
 
@classdaknok_t Yes
 
@KonradRudolph What if I don't want that?
@JohannesSchaublitb int main() {std::cout << "Hello, world!\n";}
 
@classdaknok_t Out of luck. But why don’t you? If you don’t want that, open a binary stream – but that doesn’t work for std::cout
 
@KonradRudolph I was just wondering. I was replying to a comment on an issue on GitHub.
 
11:11 AM
@LucDanton Also works … I was trying to work around Catch’s apparently unrelated error message and tried out different things
@LucDanton Incidentally, what’s the signature of the above function?
 
Does your ptr have conversion operator?
 
@LucDanton no
 
@KonradRudolph std::ostream& operator<<(std::ostream&, ptr);?
 
@LucDanton That’s not a complete signature, though … ptr is a template
 
Injected class name.
 
11:14 AM
@LucDanton Yes, I’m aware of that … but since it’s a friend I was wondering what its signature is … and, by the way, I meant the signature of the above template function
wouldn’t that be a template template?
 
No, there's a friend for each ptr<T>.
You can't refer to it btw, only call it.
 
damn
that’s complicated
 
Yep. But it's convenient.
 
ok then, why doesn’t it find the following friend?
friend ptr raw_ptr(T* value) {
    return static_cast<ptr>(value);
}
if I try calling the function via auto p = raw_ptr(new int); it doesn’t work …
 
Try qualifying the call, notice that ADL can't work for int*.
 
11:18 AM
damn I’m stupid
no, wait
I’m not, I have using the_namespace::raw_ptr; before that
 
What about qualifying though? Tried that already?
 
yes, I just did, same result
sorry, I realise this q’n’a game is shit
I’ll write up a proper working example and post it on SO
but thanks anyway, your explanation on friends of templates was helpful
but I’m off now, need to go elsewhere
 
Is it possible to move an object into an std::set? I'm so confused.
subviews_.insert(std::move(view)); and subviews_.emplace(std::move(view)); give compile errors.
 
11:34 AM
@KonradRudolph there is no ADL in your code
 
@classdaknok_t Yes.
 
11:54 AM
@user1131997 no drive-by linking. You posted that Q seconds ago. The answer is trivial and has been given < 5 minutes
See --> newbie-hints
 
1 message moved to bin
 
did I move it to the right bin this time?
 
@jalf worx for me
 
i voted to close this:
2
Q: What to put in a default label of a switch (C/C++C++11)

XploitthLet's say I have an enumerated class. (C++11 feature) enum class ShapeName : char {TRIANGLE,CIRCLE,SQUARE}; and later I have a function like this: void Function (ShapeName const shape){ switch (shape){ case ShapeName::TRIANGLE: DoSomething1(); break...

 
12:00 PM
The Lenstra elliptic curve factorization or the elliptic curve factorization method (ECM) is a fast, sub-exponential running time algorithm for integer factorization which employs elliptic curves. For general purpose factoring, ECM is the third-fastest known factoring method. The second fastest is the multiple polynomial quadratic sieve and the fastest is the general number field sieve. The Lenstra elliptic curve factorization is named after Hendrik Lenstra. Practically speaking, ECM is considered a special purpose factoring algorithm as it is most suitable for finding small factors. , i...
 
> I used to be a category theorist, but then I took an arrow in the knee.
 
12:21 PM
@Pubby OMG. I'm going to have to order this. Immediately:
I haven't been able to bring myself to reading any of Rowlings books, but this sounds like a lot of fun
 
@sehe my wife has that translation and seems to like it
 
@awoodland you married well :)
I did read Alicia in Terra Mirabilis back when. I also read 'Laus Stultutiae' and parts of the Vulgata. The latter was a bit to dry for my taste.
@CatPlusPlus to the knee, FTFY/FTFH
 
Still funny.
 
Any SO mods here?
 
@JohannesSchaublitb I know … Luc just led me astray
 
12:27 PM
@geekpanth3r nope. use mod flags to call one. Why?
 
@sehe I would like to have my edit approved. I don't want the answerer to think I didn't edit his post, and start editing.
1
A: What Are The Reserved Characters In (X)HTML?

Dima< > & " - these characters are reserved by XML format. It means that you can use < and > chars only to define tags (). Double quotes (") are used to define values of attributes () Ampersand (&) is used to write entities (for example "&", which is used when you actually want to ...

 
@geekpanth3r he'll see the pending edit. Gets a notification at least. Anyways, I can approve those too
 
@KonradRudolph Hey, it's your faulty code.
 
@geekpanth3r already done, apparently
 
@sehe Then, please do it.
@sehe I still see this
> Thanks for your edit!
> This edit will be visible only to you until it is peer reviewed.
 
12:29 PM
@geekpanth3r sorry it was about the answer
 
@sehe Can you approve my edit?
Okay, edit has been approved. Thanks!
 
@geekpanth3r now I did. had a bit of a struggle finding the right 10k page - I hardly ever use them
 
:)
@sehe Have a good one.
 
Pro tip: edit reviews and close/delete votes are 10k tools. You don't need a mod to get help. This is a community site after all
 
@sehe got it!
 
12:33 PM
cheers
 
@KonradRudolph Also I mentioned that anyway.
 
Why does MSIE ( tridient ) in its HTTP-header use Mozilla keyword in User-Agent?

Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)
 
@user1131997 99% of all browsers do that for compatibility reasons.
Safari even includes Gecko and KHTML: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/534.55.3 (KHTML, like Gecko) Version/5.1.5 Safari/534.55.3
 
The compability of what standarts? As I remember for html/css IE always wasn't a friend ( don't know about IE9/10 , only know that versions till 8.0 were always critised as non-friendly for web-standarts ).

So such keyword is in HTTP-header, and what compability do they want to rich?

Also thank you for advicing me!
 
12:50 PM
It goes back to Browser Wars and stupid JS developers.
 
The way I heard it described is, way back in the mists of time when IE was shockingly, appallingly bad, and not just really bad, some websites would have two alternate layouts - normal mode, for all compliant browsers, and suck mode, for internet explorer
when IE got slightly better at representing web content from the real world, it lied and claimed it was Mozilla so it'd get the proper version
 
IE is a parasite.
 
mawning
how NOT to move a couch
 
What is this, Zoo Overflow?
Judging by the avs, I'm the only human being in here!
 
Welcome to the Zoo!
C++ is a world full of beasts
 
1:00 PM
HeaderDoc y u no accept .hpp files.
File ./libcxxui/include/cxxui/control.hpp is not of a known header or source code file type what is wrong with this piece of shit?
 
does it take .H files?
 
Yeah.
.h, .java, .rb, .py about everything but .hpp.
not even .hh.
 
Oh, I meant captial H, some crazy people mark their cpp files with capital C
 
It doesn't understand .H, but it does understand .h. -_-
 
doh
 
1:14 PM
@sehe Dat book! o_O So ordered!
 
Fortunately it's written in Perl so I can modify it.
Finally got it to work.
 
hi, what you think, how I should start learning about Windows Device Drivers, do you know some video tutorials
 
@pranitkothari Never tried myself, but I'd find a good book
Apparently the tools for testing them from Microsoft are actually pretty good
 
@col
@Collin Right, but for startup driver developer it is very confusion to know where to start
 
1:38 PM
Video tutorials? For... drivers?
 
Ell
hi guys
 
@CatPlusPlus yes, I said that.. seems to be some what rare.. but if I got it.. life would be easier
 
Hello friend
 
Ell
is there a list of functions/operators I must override for my own smart pointer?
well its a dumb pointer but still
 
Sorry, it's not the category of software people make video tutorials for.
 
user784668
1:45 PM
Let's make a video tutorial about making video drivers!
 
Writing low-level code is not aimed at beginners. I imagine there's lots of books on the subject, if you can't piece knowledge from the Internet.
 
@Fanael not sure how serious you are - it'd probably be helpful to someone
 
@Ell swap, hash, and comparison ops I think
 
@CatPlusPlus Can you suggest good books.
 
Never read any.
On that subject.
 
1:46 PM
What books have you read?
 
Ell
swap, hash, comparison, assign, ctor, dereference?
 
Fun ones.
Programming books are boring.
3
 
Like The Foot Book?
 
C/C++ via Windows for Windows System Programming is currently I am reading
 
Ell
@CatPlusPlus code complete isn't boring
c++ primer is
 
1:47 PM
Ya I have read Code Complete 2
 
Ell
they are the only two programming books I have read
 
its nice book
 
I read the first page or two of code complete and thought it was boring
 
user784668
@TomW I doubt that, really.
 
@Ell Which books?
 
1:48 PM
Video tutorials are good for GUIs maybe. But drivers? Come on.
 
Ell
@pranitkothari code complete & c++ primer
 
Why would I want to read something that talks about doing a boring job?
 
Ell
Programming isn't boring! Its thrilling and exciting!
 
That reminds me, anyone try Coursera?
 
@Pubby THATHS GOOD
 
1:49 PM
Next thing you'll want is video tutorial on writing operating systems.
 
user784668
@CatPlusPlus Nah, we need video tutorial for EVERYTHING!
 
@Pubby Judging by how excited some colleagues get over Arduinos and so on, it's anything but boring
for some people
 
And then firmware.
 
Ell
I have an arduino :D
 
@CatPlusPlus How you guessed that?
 
1:49 PM
@TomW What's good?
I have an arduino but know nothing about electronics and so all I had it do was flash lights :(
 
Ell
Nah OSs are easy. Just use my "Operating System Creator Pro" and drag 'n drop
@Pubby same really :L made a light sensetive alarm clock
that interfaced with my laptop and played morning has broken :L
 
@Ell he he.. I want to use that
 
I'd rather have a rasperry pi and some rasperry pie
 
Ell
the thing is the fan on my laptop is so loud I can't sleep with my laptop running :L
 
I have one on order
 
Ell
1:50 PM
@Pubby I think I'm going to get one
 
a pi, that is
not a clue what I'm going to do with it
 
Ell
not sure what I'd use it for though :L
its better than my brothers computer for graphics xD
but not processor or ram
 
I want to make it play pong
 
and have no hardware knowledge whatsoever, so everything will be a steep learning curve
 
Electronics is bit like programming.
 
Ell
1:51 PM
I was thinking hooking it up to my keyboard :L
I like logic gates :D
 
@CatPlusPlus Except based in reality where nothing makes sense
 
Hell, you can program hardware to behave like other hardware. See FPGA.
 
Ell
what exactly is a fpga?
i know its a field programmable gate array
but does that mean its a big array of logic gates or what?
or do you still programme it using C or whatever?
 
Hey guys, here's a somewhat conceptual problem about C/C++
 
user784668
@Ell Usually it's something like Verilog, not C.
 
1:54 PM
Why is it that anything interfacing with hardware is almost always written in C
 
Ell
because C is "portable assembler"?
 
Surely other languages CAN do stuff like writing to registers, if someone could be bothered to write a suitable compiler
 
Because C is low-level.
 
is it just because it wouldn't be worth the effort and C does everything you'd need>
 
Other languages? If they can then they likely resemble C.
 
1:55 PM
Using already existing stuff is always easier than creating new.
 
sorry, for 'can' read 'could in principle'
 
Ell
its because C is the best tool for the job :L
3
oops
 
I'm starring that so it can be used against you out of context
 
C++ would most likely work as well as C.
 
Ell
C is never the best tool for the job. C++ is superior. Aaghhh don't kill me
damnit
I was just going to delete it but its too late :s
@CatPlusPlus but c++ compilers are more difficult to implement, and there are a wider range of architectures when we are talking about embedded vs ... not embedded?
 
1:58 PM
C++ frontends are, backends can be reused.
 
Ell
does c++ have a c backend?o.O
 
user784668
@CatPlusPlus in ideal world, frontends can be reused, too.
 
Ell
or do you mean like asm?
 
@Fanael Right.
 
Presumably all that's fundamentally required is a compiler that knows how to put suitable instructions into a PE file (for example, if we consider native apps on Windows)
 
user784668
1:59 PM
@CatPlusPlus And even in the real world they can. EDG anyone? Or GCC?
 
Ell
gcc does some random stuff
who uses gcc java?
 
user784668
@TomW Typically, a compiler emits either assembly or an object file, not an executable. That's why you need a linking step after compiling.
 
LLVM is the king anyway.
Compiler emits assembly, assembler emits object file, linker emits executable image.
 
Yes, beg your pardon. Now that you've reminded me I do realise I had some vague knowledge that would be the case
substitute 'compiler' for 'toolchain' and my statement may make more sense
 
Generalised, compiler emits intermediate representation, IR assembler emits linkable module, linker emits final image.
 
Ell
2:04 PM
argh i keep forgetting the dynamic library path for linux
is it LD_PATH?
well its not but I forgot it >.<
 
LD_LIBRARY_PATH
 
I want to draw a line on my form using Win32 API and OpenGL, I have the draw_line function, but I'm not sure where I should call it?
 
user784668
lol: pair<pair<int,int>,pair<int,int>>
 
man ld.so
 
@CatPlusPlus and the linker is language-independent? If that's the case, then actually I guess the answer to my question would be any language whose compiler can emit an object file for that platform?
 
Ell
2:05 PM
kk thank you
 
Yes, linkers usually work on bytecode.
 
user784668
I wonder if it'd be possible to write a linker in FASM.
 
If you're patient enough.
 
user784668
Not in assembly, rather in the FASM's own assemble-time language.
 
What?
 
Ell
2:09 PM
I wonder who named stuff "Libraries"
 
Some COBOL programmer I bet
 
Ell
Does anyone know how to setup the eclipse user dictionary
I have pointed it to a file, but it doesnt seem to do anything
 
user784668
What dictionary?
 
The dictionary, it does nothing!
 
Ell
anway
im off
 
2:14 PM
I'm out of fun things to do.
 
Ell
sorry
luncheon time :L
 
I have boring things to do for tomorrow.
Some Android crap, and reports for networks lab.
:<
 
Guys! Please help me with thread-leaks! Thank you very much!

I know , that it's spamming and bad stuff, but no one could help me :(

Thank you very much!
 
user784668
delete? You gotta be kidding.
 
1 message moved to bin
Once is enough.
 
2:20 PM
If i have a class X {} class Y {property, X x; }. What's the best way to check Y's property from my x of type X ?
 
oh, that prime-number-green-thing, it's back
 
Ell
im back again :)
still with the dictionary problem :L spellchecking
and also eclipse is telling me my range based for is a syntax error o.O
 
user784668
@Ell Works for me.
 
Ell
hmm
does {"blah", "blah", "blah"} make a vector? or is that an array literal? I know you can assign to a {} but I can't go {"blah", "blah", "blah"}.end() can I?
actually - what I'm trying to acheive is this:
`for(auto j : {"one", "two", "three"}) { };`
but I can't do that can I?
 
Hi everyone. If I want to create a a cache object (unordered map for concreteness), that is created and initialized when the class is defined, and exists as long as the class defn exists, and is available to all members of the class, what is a good way of doing that? Would a static data member be the best way? And would the initialization be in the body of the class?
 
2:30 PM
@FaheemMitha looks like a singleton with shared_ptr
 
@Ell for(auto i : std::vector<std::string>({"blah", "blah", "blah"}))
 
@Abyx Eep. Do I really need to use a singleton?
 
Ell
@bamboon thank you :)
hmm I wonder if vector can infer its type from the constructor?
 
@FaheemMitha You never need to use a singleton.
 
@CatPlusPlus Happy to hear that. Last time I looked at singletons I got a migrane.
 
2:32 PM
@FaheemMitha well, in any case you need some sort of global state
 
user784668
@CatPlusPlus False. You need to use a gazillion of singletons if you want your code to be completely fucked up.
 
@Abyx Would not a static member suffice? It is unique to the class, is it not?
I haven't actually tried it, though.
 
you can not name it "singleton", but for me any global state is like a singleton
 
@FaheemMitha Static should work - just make sure you handle any locking properly if you're using threads
 
@Collin Hmm, threads. Probably not sharing this across threads, no.
I read in
3
Q: Initialize a static member ( an array) in C++

vtd-xml-authorI intended to create a class which only have static members and static functions. One of the member variable is an array. Would it be possible to initialize it without using constructors? I am having lots of linking errors right now... Class A{ public: static char a[128]; static void do_som...

 
2:35 PM
Singleton and global state is not the same thing.
 
that "Non-const static members are initialized outside the class declaration (in the implementation file) as in the following:"
Then some code in global scope follows. This looks a little dodgy. Is this best practice?
Also, does this code really only run once?
Off the top of my head, I'd have thought the class body would be the right place to have this code.
 
Ell
I don't see why people hate singletons so much
if you're going to have global state, you're going to have global state
whether its a singleton or a static member or whatever doesn't matter - does it?
 
user784668
If you're going to have global state, please make it simply global and don't try to be a hypocrite.
 
@Ell : Well, I've seen people use them when something simpler would work as well.
 
mawnin nubbinses
 
2:40 PM
@Ell it's because they're abused. same as managers. people hate managers because too many people use managers for everything
 
@Ell static is simpler, and supported by the language, so preferable, surely?
 
0
A: What is the different between printf & std::ostream under windows console using UTF-8 output

Cheers and hth. - AlfYou have a number of flawed assumptions, lemme correct those first: That things appear to work with g++ does not mean that g++ works correctly. Visual Studio is not a compiler, it's an IDE that supports many languages and compilers. The conclusion that the Visual C++'s standard library needs to...

^ Today's answer.
 
Ell
@FaheemMitha yeah probably - it doesn't mean people need to say "singletons are evil" though
also - I have a short snippet of code that eclipse is telling me is a syntax error but it compiles fine - can anyone see why? pastebin.com/PHYTMhF7
 
@Ell : Fair enough. I just said they give me a headache. Which they do. But I like to keep things as simple as possible.
 
Ell
Yeah - sorry - I wasn't accusing, I've just seen people say that
 
2:41 PM
Singleton goes out of its way to be annoying.
 
user784668
@CheersandhthAlf: if the current codepage is Russian, the Greek text will be garbled, so it won't display as the OP intends. Go fix your answer. (yes, I know I'm nitpicking)
 
So, is the preferred way of initialized a static data member really to do it outside the class?
 
@Fanael ah, thanks. when all you know is russian, everything looks russian
 
Ell
@FaheemMitha you have to do it outside the class unless its an int I think?
 
except i don't know russian
hm
 
2:44 PM
@Ell Ok. Thanks.
 
Ell
@FaheemMitha I'm not sure - I'm a c++ noob
 
user784668
@CheersandhthAlf Neither do I, but I can tell apart Cyrillic and Greek :P
 
@TonyTheLion C++, the language that let's you shoot yourself in the paws
 
Ell
brb
 
user784668
@CheersandhthAlf: still broken, if the current codepage is Greek, the Russian text will be garbled.
 
2:47 PM
@Fanael oh my
 
@CatPlusPlus thx
 
user784668
@CheersandhthAlf The first word is written in Cyrillic, the second in Latin, and the third in Greek alphabet, respectively.
 
fixed, thanks!
 
@user1131997 your question got answered in 4 minutes. It got comprehensively answered in 20 minutes. Again the solution was a little bit trivial. Patience is a programming skill. Without patience you'll rage quite long before any program gets completed.
 
I recently posted the following to math.sx. This is about an approximation to log(x!).
 
Ell
2:51 PM
lwhat does -fmessage-length=0 ?
 
3
Q: Approximating log of factorial

Faheem MithaI'm wondering if people had a recommendation for approximating $\log(n!)$. I've been using Stirlings formula, $ (n + \frac{1}{2})\log(n) - n + \frac{1}{2}\log(2\pi) $ but it is not so great for smaller values of $n$. Is there something better? If not, should I calculate the exact value and swi...

 
user784668
@Ell it stops GCC from limiting the length of error messages.
 
I was wondering - would it be faster to cache these values or recalculate them on the fly - in C++, that is. Anyone have an opinion?
 
user784668
@FaheemMitha Measure.
 
Ell
ahh kk
 
2:52 PM
@Fanael : Hmm, ok.
 
Ell
how long is the longest build times you can stand?
My workflow consists of make small change -> build -> repeat
 
10 seconds.
No C++ project qualifies.
Well, less than 10. Maybe about 5.
Ideally I don't want to notice the delay.
 
Ell
mine builds in 5 seconds :D
but... it doesn't do anything yet :L
 
Borland's tools used to be fast. Their ads said "no speed limit". But then, they reasonable stopped after first error, and current tools instead do the 1950's idiocy of continuing to produce an avalanche of incorrect follow-up errors and warnings, for which eventuality the have to prepare, which wastes a lot of time.
 
2:59 PM
@Fanael +1 (@FaheemMitha)
 
Ell
fmessage-length=1? o.O thats a complete guess but doesn't that limit error messages?
or is that just gcc?
 
@CheersandhthAlf GCC has -Wfatal-errors for that. It is worthless though because it nonsensically stops halfway through the first error.
But it works properly in Clang.
 

« first day (561 days earlier)      last day (4386 days later) »