« first day (1257 days earlier)      last day (3916 days later) » 

16:09
0
Q: Stringifying a block of text in C++11

doronIn the code that I am working on has the macro #define STRINGIFY(...) #__VA_ARGS__ is defined. This does have the disadvantage that it ignores newlines. I would therefore like to define a macro that uses the new R"literal( ... )literal" format. Given that the macro form already exists, I wo...

lol
as @n-m says, cant really tell what you wish to achieve at present, so sample input and desired output would be handy:) Just wondering too if there is a specific reason for coding this with macros? as you wont be able to debug them or control them as easily as you would a function. — GMasucci 15 secs ago
Resident geniuses are coming out of the woodwork
16:23
As @CatPlusPlus said you can't with macros, depending on what it actually is that you are trying to achieve you might have better luck with a constexpr function, which if you really really wanted to call from that STRINGIFY macro for backward compatibility. — wich 5 mins ago
OMG the things people believe that constexpr is.
constexpr is fairy dust.
@R.MartinhoFernandes I still don't fully grok constexpr, but that may be because I'm not habitually writing even C++11 yet
Jan 11 at 17:07, by R. Martinho Fernandes
We can read it all on the page.
Some people go OMG MACROS and think that constexpr is a complete macro replacement or something??
idgi
@CatPlusPlus It's fairy dust, I tell ya.
16:29
cargoculting.h
@LightnessRacesinOrbit The only thing that can be done with constexpr that could not be done before is using function invocations in constant expressions.
That's it.
user1804599
Hmm.
user1804599
If I only want to capture images from a webcam with OpenCV, do I need all of OpenCV?
RTFM
Mar 19 at 8:20, by Cat Plus Plus
New to the chat? Read The Law.
@R.MartinhoFernandes C++14's relaxed constexpr is much more powerful though iirc
16:34
@DeadMG More powerful than what?
C++11's
C++11's, presumably
unless you're aware of anything else in the world that has constexpr
My statement still holds there.
hard to argue that C++17 is in the world :P
Everything you can do there you could do already; the only thing you couldn't do was using such functions in constant expressions.
relaxed constexpr is neat
@R.MartinhoFernandes Hang on what
this is where you lose me
hmm, Broken Crown Halo is great
@LightnessRacesinOrbit Hmm, why?
@LightnessRacesinOrbit I removed the XY problem.
@R.MartinhoFernandes C++11 constexpr adds the ability to invoke functions in a constant expression, then this was added in C++14?
16:45
What's worse... seeing someone programming in PHP or seeing someone programming in PHP in word?
3
@LightnessRacesinOrbit No, the only thing C++14 does is make it easier to write constexpr-enabled functions.
@R.MartinhoFernandes gdgd
@R.MartinhoFernandes Ok. How?
@LoïcFaure-Lacroix :-D
C++11 required their bodies to be a single return statement, forcing you to use recursion and other FP techniques, but now you can use multiple statements, ifs, fors, etc.
a lot of things were made constexpr too
@R.MartinhoFernandes ok fine
11 mins ago, by R. Martinho Fernandes
Everything you can do there you could do already; the only thing you couldn't do was using such functions in constant expressions.
This totally threw me off.
Puppy mentioned C++14 and then you said a thing about C++11 (for the second time)?
16:51
@LightnessRacesinOrbit Since you mentioned you hadn't used constexpr before I was trying to keep considering the differences between the before-constexpr and the after-constexpr worlds. Should have been more explicit, I guess.
I'm curious about the msg == "anus" part... — archie hicox 6 mins ago
@R.MartinhoFernandes ok np
I'm with you now then
#include "buraco/game/board/model/KingChatFilter.h"
#include "buraco\game/board/model\GamePlayController.h"
#include "boost/lexical_cast.hpp"
ugh.
le ew
user1804599
lol
16:55
Does "buraco" mean the same in Spanish as in Portuguese?
buraco is not a Spanish word
I know "agujero", but couldn't rule out other words.
My writing ability seems to be deteriorating.
there's this word, begins with "a", and means "good with words", and I every time forget what it is.
articulate.
My knee is good with words.
17:03
damn, Vlad has 17k rep
and 1,314 answers
std::map uses operator<GWW 1 hour ago
@GWW std::map does not use operator< directly, there are two indirections at work: I) std::map<K, V> is just a short-hand for std::map<K, V, std::less<K>> and II) the default implementation of std::less uses operator<. So you could specialize std::less<X> for a certain type X to use something other than operator<, or (more realistically) you could parameterize the map explicitly with a different comparator, for example std::map<K, V, std::greater<K>> to store the keys in descending order. — FredOverflow 4 mins ago
@Rapptz that was quick
Are you sure you can specialise std::less in a useful manner?
you should be able to
17:09
0
A: How to stringify a block of text in C++11 while preserving newlines?

HolyBlackCatIt's not exactly what you asking for, but as @R. Martinho Fernandes suggested you can use raw literals: const char *ptr = R"( text here )"

I have a feeling someone made a huge misunderstanding.
I don't get the question
raw string literals do preserve newlines :s
what am I missing?
Stringify doesn't.
Raw literals are irrelevant.
@R.MartinhoFernandes Still, it's the right answer.
STRINGIFY is needless.
I'm upvoting it
17:11
@LightnessRacesinOrbit I suppose it's going to be used in some macro that needs the code as code, and as a string for some output purpose.
@R.MartinhoFernandes sure, but the answer is right so what's the misunderstanding?
(I wondered about that a while back for my library)
@Rapptz I tried the opposite of suggesting raw literals, and the question is not about raw literals (hence my edit).
@R.MartinhoFernandes constexpr is really useful
17:13
@LightnessRacesinOrbit Yes, but you can't use the lambda as code.
why not?
Because it's not a lamba but just a string.
@R.MartinhoFernandes It's called "stringify". He wants to make it into a string.
i was writing [](auto i, auto j) { return i + j; }
@R.MartinhoFernandes I don't see why that matters
17:14
fixed it with std::plus<>()
but i dont see a reason why lambda expressions are not allowed in constexpr functions
I want the lambda for evaluating, and would like to give the code out in the output.
That's a use case, yes. It's not the OP's use case. So how is it relevant?
you want to evaluate code in a constexpr?
17:14
@LightnessRacesinOrbit How do you know it's not?
How do you know it is?
He wants to stringify code preserving newlines.
like as in reflection?
@R.MartinhoFernandes Because the macro is called "STRINGIFY", the question title is "How to stringify a block of text", and the existing C++03 version of his macro only stringifies.
I'm going to go on the assumption that the question is the question written, not some other question. I don't think that's unreasonable.
the OP is going to have to expand on the question more if he wants your use case
17:15
Well, then close it. It's useless.
cant he do
"line"\
"line"\
" ... " " ..." will concatenate
Yes, I think it probably is. Though I'd like a response to my comment on it first
i dont think you can write a line iterator with boost preprocessor
maybe with boost.wave
@gnzlbg That "drops" newlines too, in that they are never part of the literal in the first place. Further, you might as well not have bothered with the \.
openshift is fucking cool
17:17
yep :/
@LightnessRacesinOrbit you are right
The solution is to just fucking use raw string literals. The syntax is even shorter than calling his macro
sounds right
i dont think you can do what he wants
:/
That wouldn't help even if you could.
Adding R to a literal without newlines doesn't magick them up.
You can't get the delimiter into #__VAR_ARGS__
17:20
Even if you could you could not get a safe one.
true
There are lots of reasons this isn't possible [with raw string literals]
honestly I don't think what you wanted is possible
:v
It's not. And it wasn't me.
Oops. I did it again.
I went ahead and posted the other answer too... Hope you like it — sehe 14 secs ago
17:21
+1: This is the only sane thing to do. It's not clear why a macro is needed and, as such, it's even less clear why one would jump through hoops to make it work as desired when raw string literals already expressly provide this functionality. That's why they were added to the language. — Lightness Races in Orbit 2 mins ago
0
A: Boost: Vector of Distributions with any

sehe Note See my older answer for a discussion of solutions a vector and boost::any vs. boost::variant. If you don't actually need a dynamic vector of distributions - but just want to apply a statically known list of distributions, you can "get away" with a tuple<> of them. Now, with a bit (well...

only thing I hate about raw string literals is it fucks indentation over
Boost Fusion + Boost Phoenix can really be crazy effective. I wouldn't like to write the original answer in C++03 :S
@sehe remember boost::spirit::hold_any !!!
I do
17:21
@Rapptz yeah, good old EOF>>>
@sehe and in C++14 use a polymorphic lambda with fusion::for_each
user1804599
Coool OpenCV works.
user1804599
// #cgo LDFLAGS: -lopencv_highgui
// #include <opencv/highgui.h>
import "C"
user1804599
Nice C interop.
@LightnessRacesinOrbit The answer doesn't say how to write a macro that stringifies maintaining newlines. Yes, the OP didn't say what they were going to use this for, but they did specify what they wanted to fix in their existing code.
17:27
Does anyone happen to know how to extract the instruction and operands from an instruction word of x86_64 assembly?
@R.MartinhoFernandes The answer takes the form of "don't". It may not completely correlate with the question if taken literally, but it's the only valid answer that is possible!
It's not. I'm about to give one.
this had better be good!
ghello people
gwhat is ghe lounge up to tonight
17:33
@nightcracker angry ranting
oooh, new NASA update for KSP makes xenon engines more powerful and require less power too. That Mun hovercraft should be rather easy now :D
@StackedCrooked what about this time?
oculus rift acquisition?
world peace?
or, more importantly, C++?
@nightcracker C++, C and PHP
so, I've put my old modeler on sale
@StackedCrooked Don't you dare name those three letters here
17:34
feels a bit sad
I liked that piece of hardware
@StackedCrooked nah, PHP is a fine language
Well, then don't sell it.
@nightcracker Yeah, it's so nice.
ask Mt. Gox, they used it to write a homebrew SSH daemon - it can do anything!
I once wrote a code in PHP and it cured cancer.
> a code
> A CODE
> A CODE
> A CODE
-.-
17:35
@nightcracker Really?
AAAAAAAAAAAAAAAAA COOOOOOOOOOODDDDDDDDDDDEEEEEEEEEEEEEEE?!!??????????!!!!11111!!!1 ONE!!! ONEELEVEN
-3
Q: I was wondering how would I convert BASIC into C++?

Thomas ShortallI have to try and work out the differences between BASIC and C++ and convert a program which is BASIC to C++, so I am asking if there is any good sources that will help me on this. Thank you in advance. edit: I am using the book which holds the program that I will be converting called micropu...

@R.MartinhoFernandes that was Mark Karpeles's blog
Oculus would be great for games like Myst.
@StackedCrooked would've been*
Oh, actually Myst for Oculus is under development.
@nightcracker Doesn't mention Gox anywhere.
Now I can't laugh.
@R.MartinhoFernandes Mark Karpeles was Mt. Gox's CEO
that was his blog
But didn't use it in Gox.
17:42
Well, at least he didn't say so.
Can't laugh at it if it's not true.
@R.MartinhoFernandes Good. Now append the other answer to yours and it's spot on
Schadenfreude, maybe.
leedvermaak, you mean
17:48
That's not a loanword in English.
who cares about english?
we spreken toch allemaal nederlands hier
user1804599
Awesome.
Soon in the next barber next to you: "Could you make me a Kim Jong-un please?"
"Sure; what are the ingredients?"
17:51
Or may be the "please" and "could you" are superfluous
and the "me", it turns out
well there yes. Here no
I guess, there, all words are superflous now
@LoïcFaure-Lacroix Not "Dear Leader".
@R.MartinhoFernandes Kim Jong-un does the haircut himself?
17:56
need moar starz
Probably channels his superior hairstyling skills into all hairdressers in the country.
btw what do you think about Facebook acquiring Occulus rift?
it's silly
IT'S THE FUTURE OF SOCIAL MEDIA, they said
17:59
it's the future gimmick everybody will drop after five years
I think it's funny because they were kickstarted and then BAM Facebook.
I'm still waiting for VR farm ville
@R.MartinhoFernandes bullshit though
like 2.5m from kickstarter
88m from other sources
"kickstarted"
It's not really funny for some people... I heard a guy spent 10k on that
and the kickstarter was for a dev kit, which they delivered
18:01
Kickstarter projects are investments, not purchases.
like, I'd be probably pissed off too if I put money into it, but it's not fair to say that they didn't deliver or were "kickstarted"
@DeadMG That's wrong you're not investing at all
even if it's an investment, would you invest on something knowing that Facebook will buy it later and screw it?
an investment would mean that you own a share of some kind
it is charity
18:03
It's very often preorders of stuff that may not even come to exist.
@atomicode No, an investment would mean that you pay money up front for a product that might not exist and if it even does, might not be what you wanted and you could absolutely not get any return for your money.
buying shares is just the simplest and most common example of an investment.
@LoïcFaure-Lacroix It's funny to read nerd reactions
> In finance, investment is putting money into an asset with the expectation of capital appreciation, dividends, and/or interest earnings.
OH NO EVIL FACEBOOK HAS TAKEN OVER OUR GAMING IMPLEMENT
18:06
@CatPlusPlus I can't argue about that
ITT Cat isn't the biggest cocksucking nerd of them all
@R.MartinhoFernandes do we need to set up a "Africa for Martinho" project to send radiators to you?
@LoïcFaure-Lacroix Since when do investments involve knowing anything at all?
@nightcracker s/expectation/hope/
Also who said Facebook is going to screw it
@LightnessRacesinOrbit that would be editorializing.
18:08
@LightnessRacesinOrbit it doesn't but if you knew would you invest?
@CatPlusPlus everyone
@CatPlusPlus nobody has to say that... did facebook do anything great in the last 10 years?
@LoïcFaure-Lacroix set up a global network where you can contact people you know?
facebook will read informations from your soul via your eyes and sell them
and play farmville?
18:09
They contributed several things to the OSS ecosystem over the years
Also what
@LoïcFaure-Lacroix Of course not
Likewise, if I knew that an airplane would crash I probably wouldn't board it.
And that's about as useful a thing to say
I wouldn't invest in a gimmicky gaming gadget either :v
@CatPlusPlus no, that's not how it works cat
Xeo
Xeo
Next big NK news: 'Men in North Korea are now required to have the same face as their Dear Leader'
@Jefffrey joke's on them: robots don't have souls.
18:10
any news about the stolen airplaine btw?
@CatPlusPlus one does not simply disagree with the hivemind
@LoïcFaure-Lacroix It probably ended up in the ocean
@CatPlusPlus it transformed itself into a submarine?
@R.MartinhoFernandes then they will hack your brain via your eye backdoor
18:12
Definitely a wormhole.
"stolen" airplane
pretty sure it was used for a terrorist attack against dolphins
well they still haven't found where it did crash and usually they can find it in like a day or 2
@nightcracker And dolphins shot it down
Wormhole would leave no trace!
@LoïcFaure-Lacroix That's based on transponder signals. No transponder = no plane
18:14
no plane = no problem?
There's only some prediction based on satellite data afair, they don't have any exact spots to look at
@R.MartinhoFernandes A whole worm?!
I know but it's been like 2 or 3 weeks or more
Why can't they use those military satelite to find the damn plane
Ocean is p big
> Malaysia's transport minister Hishammuddin Hussein updates the media on Wednesday with the latest developments in the search for Malaysian Airlines flight MH370. Hishammuding says new satellite images show 122 potential objects 1,588 miles from Perth.
18:19
The Minbari came over and sent it back to fight in the First Shadow War.
lol this guy comes on a forum and says he can't start his game because of an error with the code "oxcooooo7b", then posts this screenshot
I've never seen something so ugly in my life
You're spoiled.
OSX hipster that can't actually afford Apple hardware spotted
@CatPlusPlus don't those usually build hackintosh machines?
18:25
It's not that bad
Hackintosh is not what I'd call usable
@CatPlusPlus Who would want to buy Apple hardware anyway?
I wonder on how many areas that font is spread
And OSX, neither, badumtsh
I mean, it's so overpriced
18:27
the point was the fact that zero looks like the letter 'o'
@DeadMG vOv
I have no idea how other digits look
@DeadMG the trackpad is nice
but then again
who'd want to actually use OSX?
18:27
@CatPlusPlus on some configs you can reach decent levels of usability... as long as you don't update
osx is better than windows, yet maverick is quite unstable
Euro Truck Simulator.
@AlexM. There are computers where Linux has driver issues. There are also computers where Hackintosh doesn't have driver issues
But seriously fuck OSX
The only thing that makes me use osx most of the time is on linux, I have 3 hours on battery... windows 6 hours and osx... who knows... 7 8 hours may be
It lasts longer because it's so bad you don't want to work on it!
18:30
Nah, I got a decent terminal
vim and zsh
Gentoo/Arch + i3 as WM
Or any *nix really
Though BSD coreutils are annoying
There's a lot of people making fun of DSP on my Twitter feed
Derpal Space Program?
2
DarkSydePhil, the endless well of hilarious terribleness
What the fuck happened to my fanbase? They became self-entitled, greedy, whiny, demanding viewers who feel I should do whatever they say.
user1804599
18:42
@AlexM. that’s the ugliest desktop I have ever seen in my life.
yup yup
user1804599
Why is the Windows logo not centred vertically.
@rightfold because windows sucks
it sucks vertically
so you're not centered horizontally
1
A: Efficient Division by Least Significant Bit set in C/C++

patHow about x >>= ffs(x)-1; The ffs function conforms to 4.3BSD, POSIX.1-2001. It won't work if x is 0.

^^ Why the hell would someone name a function ffs? I mean, for fuck's sake... why?!?! aha
"I was going to change the world with VR and try to change humanity forever, but here's a number." http://t.co/fTgd6Y2J77
18:48
Find first set
nice
It's hard to wake up on-time every day, to play eight hours of games. It's not stress-free. Fuck you, if you think it's so easy. I wish.
WTF someone used up all of my remaining tea and left the package empty on the shelf what kind of disrepectful bullshit is this.
welcome to living with others
something like int _ffs = ffs(x); x >>= _ffs - !!_ffs; should work for zero as well.. — Pavel Davydov 29 mins ago
!!ffs!
@R.MartinhoFernandes hahahaah
18:58
@Griwes FFS...
I'm fine with people taking some of my stuff from time to time. But now I have to go out into the cold to buy some damn tea.

« first day (1257 days earlier)      last day (3916 days later) »