« first day (1012 days earlier)      last day (3940 days later) » 

9:06 AM
I need food ... but I have been good lately, mainly because I spend a lot of time away from easy food, partly because I have too many little things to worry about
 
@BartekBanachewicz True. His points are not pulled out of ass: they are pulled out of his ignorance and his desire to perpetuate it.
It's just a "cry mommy, boost doesn't have the same interface I saw before I dun wanna read cry" rant.
He even shows ignorance about the interfaces he claims superior; how do you expect him to know about the ones he derides?
Good luck simulating a die with rand() in under three lines.
 
I always wonder how many people with nicknames are on this chat
for example, luc could be an alter ego of robor
 
@Rapptz Exactly.
 
@Abyx What's the problem?
 
9:15 AM
@BartekBanachewicz Did you find that on reddit or something?
 
Is Jekyll decent?
 
can somebody help? :)
 
I don't know why it's giving me this "iffy" feeling
 
@Rapptz I like it.
 
It seems annoying to set up on Windows.
 
9:17 AM
@wilx its API. it's bad.
 
@Rapptz Oh yeah, that's true.
 
Really? It seems to me that only streambuf API is really bad. Rest is ok enough.
 
Xeo
29
Q: How to prevent the arrowhead anti-pattern

KippieI'm a bit confused about how to best refactor my code into something more readable. Consider this piece of code: var foo = getfoo(); if(foo!=null) { var bar = getbar(foo); if(bar!=null) { var moo = getmoo(bar); if(moo!=null) { var cow = getcow(moo...

haha, monads!
 
std::cin sucks. std::cout sucks too.
 
Though, yeah, there are things like the member getline() functions.
@Rapptz: Why?
 
9:19 AM
getline is okay
 
Non-member getline() is ok, the member ones are bad API.
 
It's more annoying to use than their counterpart C functions fprintf and fscanf.
I like fstream more than FILE* though
 
yeah start writing C buddy
 
then there are.. the other things that people talk about here "streams suck" etc
 
I agree that the IO part of the standard library could use some small reinvention. But I do not think it is too terrible.
Dunno, maybe I am just easily pleased. :)
 
9:21 AM
You can write a safe printf using variadic templates which makes it less painful to use I guess.
It's just over the years I really disliked doing std::cout << "Stuff: " << x << " other string etc " << othervar << '\n';
 
@wilx Personally I think the fact that the only extension point that isn't a total unholy mess is overloading operator<< speaks volumes.
 
Xeo
std::cout << boost::format("Stuff: %1% other string etc %2% \n") % x % othervar;!
 
@R.MartinhoFernandes no, I found that randomly, ironically, looking for boost/std::is_any_of in meta version
 
or just std::cout << format("Stuff: {0} other string etc {1}\n", x, othervar) for me.
 
JBL
@Rapptz Just for the syntax ? Or there's something else wrt/ the standard IO lib ?
 
9:24 AM
The syntax is annoying.
 
@R.MartinhoFernandes hey, the rand example was particularly bad
 
@BartekBanachewicz Dammit. No comments then. I feel like we might have lost a lamb.
 
Xeo
@BartekBanachewicz mpl?
 
@Xeo prolly, yeah. you know, related to what I've asked you yesterday's today's night
anyway, I took a shower, and wast thinking, and I think one thing is the most annoying for me personally in std
 
good mawning
 
// this works
unsigned sum = 0u;
for (auto i : cont)
    sum += i;

// that works not
unsigned sum = std::accumulate(cont);
 
Isn't that easy to write by yourself?
 
@R.MartinhoFernandes yeah, but I simply wonder why, if the rationale behind range for was evident, couldn't they adapt algorithms :P
 
Or does that do something else I'm aware of? I've never used MPL.
 
9:27 AM
@Rapptz I need that for pseudo-is_contiguous, if you've unplonked me already
 
@BartekBanachewicz Because 1) the naming would cause overload conflicts; 2) they didn't want to commit to a range specification.
 
@R.MartinhoFernandes 1) sigh 2) why?
 
Well I guess if Jekyll is a pain to use on Windows I won't use it :(
I'll just expand on my buildmd.cpp thing I've worked on on/off for like 7 months.
 
people aren't responding me ... it has been 3 hours and there is no reply ...
 
@BartekBanachewicz I guess that because they feel there's more than such conveniences to be gained from it, and feared that committing to a design without thinking it through might lock them out of those benefits.
 
9:30 AM
3 WHOLE HOURS!!
and both to do with tomorrow's activities ...
 
(Same rationale for not adding polymorphic lambdas.)
 
Backwards compatibility, dammit.
 
Forward, in this case.
 
Stoping progress since whoever invented anything.
 
It's about not progressing too fast down a bad road.
 
9:33 AM
and in all that time they're talking about it, people look at C++ and articles like this and say "meh"
 
if it's down a bad road then it is not progressing ... just saying ...
 
I agree with you, I just kinda feel sad.
 
Who cares. No time for losers.
 
In the meantime, Boost.Range, here I come. (not that I'm using it already)
 
Xeo
Boost.Range is meh past the first few uses.
 
9:35 AM
hehe, I remember when Xeo would talk about it like sliced bread.
 
main.cpp:11:50: error: no matching function for call to ‘accumulate(<brace-enclosed initializer list>)’
     cout << boost::accumulate({ 1, 2, 3, 4, 5, 6});
...
 
Initializer lists don't get deduced on templates. Sort of suckage.
 
Yeah I don't like that.
It's as if they don't exist outside of constructors.
 
@Rapptz OMG. how can people do that to an animal? Glad that whoever posted these photos saved this dog.
 
Xeo
9:37 AM
@R.MartinhoFernandes That was within the first few uses :(
 
cout << boost::accumulate(vector<int>{ 1, 2, 3, 4, 5, 6 }, 0); at least that works.
still suckage.
 
Xeo
@R.MartinhoFernandes IIRC, they want to remove deduction for auto x = {1,2,3}; too, no?
 
cout << boost::accumulate(initializer_list<int>{ 1, 2, 3, 4, 5, 6 }, 0); amazing.
 
@Xeo hahah, good luck with that.
 
user142019
@R.MartinhoFernandes template variable?
 
9:40 AM
@R.MartinhoFernandes lol that's horrible
Decent work around I guess, yet at the same time horrible.
 
Can't be list(1,2,3,4,5,6), btw.
 
yeah I wouldn't expect that to compile :P
 
Xeo
Can be, with the right definition of list!
 
user142019
Arghg.
 
@Xeo that one is ok imo, but auto x{42}; is meh
 
9:41 AM
@Xeo Go ahead. And don't return local initializer_lists.
 
Xeo
@R.MartinhoFernandes heh, true
 
user142019
"Why do I get my source code back?" Forgot to add <?php lol.
 
@Rapptz Nah, the thing is, even if you change it to compile, returning an initializer_list local is like returning a reference to a local.
 
@R.MartinhoFernandes Yeah, we've talked about that before.
 
@ArneMertz why? that's uniform initalization
wow we're actually talking about C++
 
Xeo
9:45 AM
@R.MartinhoFernandes Hm, if you could reference preceding parameters in a default argument...
 
user142019
What's the equivalent of mkdir -p on Windows?
 
@BartekBanachewicz something I am starting to like the idea of more and more. A clear difference between initialisation and assignment
 
@thecoshman ohai. I've refactored and built minicraft with GLDR and GLload yesterday
 
@BartekBanachewicz I noticed
 
9:47 AM
@thecoshman oh, I dunno, I was extremely sleepy when I finished
 
user142019
C:\Windows\system32\cmd.exe /c mkdir {service,component/{controller,ajax,block}}

De syntaxis van de opdracht is onjuist.
shell returned 1
Hit any key to close this window...
 
I've found a few bugz in GLDR already
 
user142019
Arrrggsssgsgsg wtf.
 
@rightfold install proper gnu tools, or use a scripting language?
 
Xeo
@R.MartinhoFernandes Was there something supposed to be coming after that?
 
user142019
@jalf No idea how to configure Vim to use PowerShell.
 
return { ... }; is not "create a temporary of the return type and return it". It's "initialize the return value directly".
 
Xeo
@R.MartinhoFernandes Oh, that's interesting
 
@R.MartinhoFernandes Hm, cool.
 
@rightfold poor sod
 
9:54 AM
@R.MartinhoFernandes Isn't that how it works with std::array too?
 
return brick{ n }; would fail.
 
Ah
 
user142019
I should really install Gentoo.
 
Xeo
The bin will know the answer.
 
user142019
> using namespace std;
 
user142019
10:01 AM
Get out.
 
^ this
 
problem description noun phrase, not a snippet of code.
 
for what value of input , the program goes into infinite loop ??
 
2 messages moved to bin
 
lol'd
 
user142019
10:03 AM
fail
 
GET OUT
3
 
Is there a loop on input? I keep seeing the same bad code over and over again.
 
0
Q: A* bad performance in larger spaces

kusuthis is my first implementation of A* algorithm and i have some trouble with it. Generally everything works, but in some kinds of labyrinth it takes long time to find the goal. Size of the map - 96x128 14 min 1 1,45 sec 2 If anyone can tell me where is error i'll thankful. :) And here's the ...

please close
 
2 days ago, by R. Martinho Fernandes
There is also a button labelled "Ask Question" which leads you to a page where you can create your very own question on the part of the site dedicated to questions.
 
this is a bad question and OP should feel bad
 
user142019
10:05 AM
user image
7
 
@TonyTheLion haha. NYPDS - Not Your Personal Debugging Service
 
@TonyTheLion Is that a snail in the first picture?
 
@FlorisVelleman looks like it
 
Xeo
Holy shit what's going on
 
2 messages moved to bin
 
user142019
10:07 AM
:10806075 JSON.parse(myJSONString).id
 
see message with red arrows above
 
@rightfold so close
 
@TonyTheLion oh man, your action was hysterical :)
 
I'm glad you find it hysterical, but you should learn that this room is not a helpdesk and we don't do JSON in here
 
user142019
hystericial
 
10:08 AM
@CodeJack Hello Dude
I should now start writing this infinitely
 
hi, is there a good link/article/SO answer that gives rules when to use emplace_back/push_back (ofc problem is general about emplace vs insert not just for vector deque)
 
@NoSenseEtAl Most likely.
 
emplace_back is for temporaries that can be moved
 
Xeo
No
 
@Tuntuni good to know :)
 
user142019
10:10 AM
@TonyTheLion emplace_back constructs the object in-place.
 
user142019
push_back can move.
 
Wait wut
 
Xeo
What the pony says
 
I had it wrong all this time?
 
@TonyTheLion Why not?
 
10:10 AM
ITT I'm wrong
@R.MartinhoFernandes cause, I decided so.
 
@TonyTheLion i asked to point me to some examples/tutorials on how to do that, no to solve that for me right here, in chat, and i don't see the point of creating a new thread regarding this mini-question, that's why i asked here
anyway..
 
We've had people handling JSON in C++ here before.
 
user142019
I think emplace_back can move too because it can construct in-place with the move constructor of T. Not sure though.
 
It's not far fetched or anything.
 
Xeo
@rightfold ya
 
10:11 AM
@ddacot I don't see the point in many things, so fucking what?
 
Xeo
It simply forwards
Which is a move for rvalues
 
@ddacot these are not "threads". They are questions
 
Some people prefer it to XML and shit.
 
user142019
@Xeo Do we need push_back at all?
 
Xeo
Not really
 
10:12 AM
but wait
 
wait what
 
Xeo
People seem to tend towards emplace_back, it seems
 
251
Q: What's the best C++ JSON parser?

Sam BakerI've seen the C++ JSON links on the official JSON site and would like some feedback on which parser people prefer - for reliability, speed and ease of use.

 
I thought emplace had been created to support rvalue references
 
@Xeo it has a cooler name
 
10:12 AM
@BartekBanachewicz oh you misunderstood me.
 
@Xeo, but why not just make push_back call emplace_back and problem solved :)
 
@TonyTheLion and as a side effect renders push_back (more or less) obsolete
 
@Xeo push_back has different guarantees.
 
Xeo
@NoSenseEtAl wat
@R.MartinhoFernandes mh?
@TonyTheLion No
 
user142019
@TonyTheLion It removes the overhead of copying and moving. It wasn't possible before due to the lack of variadic templates.
 
Xeo
10:13 AM
It was created to handle emplace construction.
 
Emplace forwards the arguments
 
@Xeo damn. I need to read up on it then I suppose
 
@Xeo you said we dont really need push_back, so i asked why not have push_back call emplace_back and that way have bwrd compat
 
Xeo
wat
 
vector_of_t.push_back(not_a_t_but_i_thought_so); // no implicit conversion crap, earlier failure
vector_of_t.emplace_back(not_a_t_but_i_thought_so); // "fine"
 
Xeo
10:14 AM
You still make no sense
 
Of course, you can always emplace a temporary instead.
 
v.emplace_back(foo()); is valid?
but v.push_back(foo()); not valid?
 
120
Q: push_back vs emplace_back

ronagI'm a bit confused regarding the difference between push_back and emplace_back. void emplace_back(Type&& _Val); void push_back(const Type& _Val); void push_back(Type&& _Val); As there is a push_back overload taking a rvalue reference I don't quite see what the purpose of emplace_back becomes?

 
Xeo
@R.MartinhoFernandes Ah, so push_back simply doesn't allow explicit-only conversions. makes sense
 
@Tuntuni tnx but that A isnt really clear to ... i guess it is above my skill lvl :)
 
10:16 AM
@TonyTheLion If foo() cannot be implicitly converted to the value type of v.
emplace_back accepts anything and calls a constructor. push_back will only accept Ts.
 
@NoSenseEtAl Just so you know, all it took to find that answer was typing "emplace_back" into Google.
 
@R.MartinhoFernandes oh I see.
 
@Tuntuni i found that A before, but like i said it doesnt A my Q or i dont get it... aka when use insert when emplace and is there diff in perf IRL
btw STL recently made a comment to some guys blog that he should emplace with ifstream iirc so it is probably there some perf diff, will try to dig up the linkl
 
dude, punctuation
 
I expect ifstream moves to be cheap.
 
10:20 AM
Stephan T. Lavavej says:
July 19, 2013 at 3:32 am

Instead of “ans.push_back(ifstream{name(i)});” you can say “ans.emplace_back(name(i));” which is shorter and more efficient.
Reply

Andrzej Krzemieński says:
July 19, 2013 at 7:41 am

Thanks, I fixed it.
Reply
 
And don't give me any "millions of times in a loop" crap. Who the fuck creates millions of ifstreams in a loop.
 
@R.MartinhoFernandes Haha
 
@NoSenseEtAl it is spelled "fuckups", fyi
 
^ this
 
10:21 AM
If you're old enough to say the word, you're old enough to spell it correctly too
 
@jalf I would find "fuck*ps" acceptable too.
 
@BartekBanachewicz : hello bartek...
 
As long as there's "fuck", it's fine. :D
 
need some help....can u help me...
 
@CodeJack try calling 911?
 
10:23 AM
if you stop spamming dots, perhaps I can
 
3
A: Fast Inverse Square Root algorithm in modern C++

Howard HinnantI'm adding an answer not to refute the accepted answer, but to augment it. I believe the accepted answer is both correct and efficient (and I've just upvoted it). However I wanted to demonstrate another technique that is just as correct and efficient: float InverseSquareRoot(float x) { uni...

Interesting (two things: that Howard believed it to be ok, and that the committee gave him feedback to convince him that it wasn't).
 
ok ,
 
@R.MartinhoFernandes nice answer, ok, well, yours only. blergh unions
 
Xeo
For up to C++11, you can use my above union trick to be free of aliasing issues: union A { float x; int32_t y; }; int32_t value = A{3.14f}.y; (I don't really think that this is anymore safer than doing it without the temporary :D). The reason this "works" is that the initializer is a prvalue and hence is free of the aliasing rule restrictions. This however will change in C++14 because the initializer will be an xvalue :) — Johannes Schaub - litb 14 hours ago
I find this more interesting.
 
is subtracting from signed int minimum UB?
 
10:27 AM
@Xeo huh, that's interesting
 
Xeo
@BartekBanachewicz I think so
Under- and overflow on signed integers are UB as far as I'm aware.
 
@BartekBanachewicz Any non-representable result on a signed type means undefined behaviour.
 
@Xeo IB I think.
 
@Xeo See bames comments.
 
Xeo
Fammit, my space bar isn't working all the time when I hit it on the far left side :(
 
10:33 AM
Your space bar sucks.
 
@StackedCrooked I agree. His space bar sucks.
 
time for the Harry Potter soundtrack
2
 
It sucks monkey dick.
 
hatred of D3D is fanboyish? oh please. the API is horrid
 
 
10:37 AM
@BartekBanachewicz Oh no you won't - Avada Kedavra!!
 
"Avada Kedavra"???
oh a Harry Potter thing okay
 
> Grey goo (alternatively spelled gray goo) is a hypothetical end-of-the-world scenario involving molecular nanotechnology in which out-of-control self-replicating robots consume all matter on Earth while building more of themselves,
 
thought you were being a muppet
 
@BartekBanachewicz There's also blue goo.
 
Huh. I cannot initialise a vector<tuple<something,more>> with the uniform intialiser {{a,b}, {c,d}, …}. Disappointing.
 
10:42 AM
I think my Line class is hardly optimal. Each line compiles a shader for itself :F
 
List-initialisation not counting as explicit is bollocks.
> On one occasion, Jimmy Carter left nuclear launch codes in his suit when it was sent in for dry cleaning.
 
oh gawd
 
damn, getting rid of bind()-s feels good
gtfo global state.
urgh ICC still doesn't accept raw literals
 
emplace_back in VS is wrong
:( cause no variadic templates
how useless
 
@TonyTheLion it has pseudo-variadic overload
for up to 5 arguments I think
 
10:51 AM
ugh
 
@TonyTheLion do you need more than 5? :P
 
MS Y U NO GET YOUR ACT TOGETHER AND IMPLEMENT SHIT PROPERLY?
 
that's a good question indeed.
 
0
Q: In c++, is there a way to jump from one function to another

neckTwiIn C++ can i jump from inside A() to B() without A() in call stack? Does goto work? My situation is I should destroy an object at the end of one of its function. class timeBomb{ public: void detonate(int time){ sleep(time); goto blast(this); //something like that }; timeBomb(); } ...

 
11:03 AM
my eyes
need goggles
 
goto this->blast(this); //something like that
//...
static void blast(timeBomb bomb)
He just keeps on randomly throwing syntax at it.
 
I'm pretty sure he came from Java.
> delete bomb;
That convinces me
 
@R.MartinhoFernandes Is development not hard enough as it is? Is there such a sudden dearth of normal bugs that someone wants something as gruesome as 'jumping between functions'? Not even a sane title.
 
It looks like an XY problem though
 
Oh. PHP. Close enough :D
 
11:07 AM
hahah, answering on SO with Boost.PP code :3
god, what I've become.
 
0
A: Speed difference of dynamic and classical multi-dimentional arrays

Magtheridon96You won't be able to spot any difference between them in a typical application unless your arrays are pretty huge and you spend a lot of time reading/writing to them, but nonetheless, there is a difference. float matris_cos[kuanta][d][angle_scale]; 1) The memory for this multidimensional array...

Frankly, I have no idea if what I'm saying is right.
It's not that I don't know this stuff, I'm just tired and pretty sick.
 
Xeo
@TonyTheLion VS2013 says hello
 
oh
well
 
@Xeo and then immediately crashes with ICE
 
Xeo
heh
 
11:15 AM
I don't like it when something doesn't work for apparently mysterious reasons. This happens to me way too often
 
UB much?
lack of unit tests?
 
not UB
 
(Boost.)PP!
 
If we define it as UB, it's no longer UB, it's DB
 
11:16 AM
@R.MartinhoFernandes Considering posting the answer but my eyes bleed
 
its just I don't know where to start looking in the code for reasons it doesn't work
 
Use a debugger and step through the instructions
 
@Magtheridon96 or just... B.
 
All my programs have Naughty Behavior ;)
 
@Magtheridon96 through millions of lines, some of which are executed 1000's of times even for fairly simple cases
Thanks, but no thanks
 
11:20 AM
;_;
 
@BartekBanachewicz global state or lack of error handling, much more mundane. and more likely
 
can't believe I just posted that
 
Please guys bear with me. I could have gone away with delete this. but in my code on a specific condition the constructor itself has to call a function which in turn call a function like detonate. — neckTwi 7 mins ago
 
@sehe <3 thanks
 
11:28 AM
> timeBomb *myBomb = new timeBomb();
 
@BartekBanachewicz why not use variadic macros? (instead of PP_REPEAT)
 
@FlorisVelleman That can be timeBomb myBomb; simply
 
@refp because PP is cool, and Variadic Macros don't work everywhere
 
@FlorisVelleman That's nothing. See my comments here ideone.com/DN9vHW The question hath since been deleted.
@R.MartinhoFernandes grizzly or panda?
 
@BartekBanachewicz everywhere as in in every compiler? well, alright
@BartekBanachewicz you could add it to your answer though
 
11:30 AM
meh downvote :L
 
At least you know someone took the time to read your answer ^.^
 
@sehe what does that even do
 
@FlorisVelleman It was fixed up from a 395 line C-style pthreads homework blob of code.
 
yaay upvote
 
11:31 AM
 
there are 32 Qs in :D
 
@FlorisVelleman ^ that was also for that question
 
@sehe Page not found :( you still going to C++ meeting btw?
 
Xeo
So, I just went to my boss, since we wanted to talk about my salary sometime. Turns out he already raised it, but just forgot to tell me.
10
 
i.imgur.com/uJpRmxV.png were my comments and ideone.com/FJ2fsj the original code
@Xeo Sounds like weaseling
 
Xeo
11:34 AM
why?
 
@FlorisVelleman Of course. How would I suddenly not go anymore?
 
ITT polar bear has got a stalker
 
ugh, trying to get rid of singletons... :/
 
@jalf ah, right, your code contains singletons
just slap dependency injection on it and you're done
 
@BartekBanachewicz not my code. The code base at work
I did a bit of grepping around and as far as I could tell, around 70 of them :(
 
11:37 AM
Jeez
 
@Xeo I dunno. I don't know your boss. But this seems not unrealistic:
Employee: Boss, I'd like to talk about my salary one time.
Boss: Yeah okay. Kinda busy. I'll schedule something.

(weeks later:) Employee: About that talk, when would be convenient?
Boss: Oh, ah. Yeah, after next week, will be on business trip.

(weeks later): Boss, I really want to have a talk about my salary now.
Boss: (sweating, thinking: uh no. I carn't negotiate. What will he ask. Hmm. If I just push a raise and put it as a given, I can avoid the confrontation)
 
@jalf ouch
 
@jalf As long as it's 70 instances of the same singleton :D
 
Xeo
@sehe Cue singleton base
 
11:38 AM
@sehe Heh, it's 70 different singleton classes
 
a previous boss of mine promised me a raise I never ended up getting
 
@jalf (kinda obvious innit)
 
that was bad
 
@sehe :)
 
:)
 
Xeo
11:39 AM
@sehe Nah. We had employee-talks with our bosses a while ago, and he mentioned that he considered a raise, with my trial period being over and me being pretty good at what was thrown at me.
And I just happened to walk past him and thought about asking him about that.
 
anyway, most of them are mostly tolerable, but a couple of them are just an endless source of bugs
 
Xeo
@sehe Also, the raise amount was pretty much what I was going for anyways.
@TonyTheLion ow
 
oooh 1 more downvote for peer pressure
thanks
 
11:48 AM
@Xeo And you didn't notice?
 
Xeo
@R.MartinhoFernandes He raised it this month, and salary is going out tomorrow I think
 
@jalf Still? I thought you had that purge months ago.
 
@R.MartinhoFernandes not at all. I did a bit of work on it some months ago, but didn't get anything that even compiled. I just picked it up again to see if I can get a bit further
 
Oh. Sounds—I was going to say "messy", but nah, it just sounds normal for singletons.
 
11:51 AM
erhg I can't C++
Do I have to "peel" the Container type off the type I'm taking to check it?
 
Xeo
wat?
 
@Xeo Ah, ok. I do agree with sehe that it is a bit of a dickish move to do it behind your back.
 
you'll be angry if I post my pathetic tmp attempts again
template<
    typename Container,
    typename T,
    class = typename std::enable_if<std::is_pod<T>::value>,
    class = typename std::enable_if<detail::var_or<
        //std::is_same<Container, detail::alias<T[]>>,
        std::is_same<Container<T>, std::array<T>>::value,
        std::is_same<Container<T>, std::vector<T>>::value
        >::value
        >
>
void data(Container<T> const& v) {
}
 
(Yes, you can be dickish when you do stuff that "helps" others)
 
I'm blaming overcomplication of C++ templates as always :3
 
11:53 AM
hey can any1 pls take a look at my question stackoverflow.com/questions/17831396/…
 
Containers?
 
Xeo
@BartekBanachewicz Ugh, just use partial specialization of a trait
 
@Xeo Or overloads.
 
but the code inside will be the same for both of them
 
Xeo
Delegate to a common implementation vOv
 
11:55 AM
and specialization/overloads would require me to repeat it, no?
@Xeo generics my ass.
 
Xeo
template<class T> struct is_contiguous_range : std::false_type{};
template<class T, size_t N> struct is_contiguous_range<T[N]> : std::true_type{};
template<class T, size_t N> struct is_contiguous_range<std::array<T, N>> : std::true_type{};
template<class T, class Alloc> struct is_contiguous_range<std::vector<T, Alloc>> : std::true_type{};
 
@BartekBanachewicz Your code is not generic... it only works for those two things...
 
@Xeo aha!
@R.MartinhoFernandes it works for every contiguous pod container, or at least I'd want it to
 
What about std::pair<T*, T*>?
(more or less array_ref)
 
@R.MartinhoFernandes um, that would require me to convert on the interface, no?
 
11:59 AM
std::pair<T&, T&>
 

« first day (1012 days earlier)      last day (3940 days later) »