Conversation started Oct 30, 2012 at 16:09.
Xeo
Xeo
Oct 30, 2012 16:09
@NeelBasu Do you mean if the counter bounds are known constant expressions?
@Xeo What I meant is for_each<range_c<int, 0, 2>> will call function f thrice and first with argument 0 and second with argument 1 and third with argument 2
Xeo
Xeo
Decide, twice or thrice. :)
sorry thrice
What I see currently is f is being called twice and all times the value its being passsed is 2
@Xeo I edited ......... and its thrice now
posted on October 29, 2012 by Eric Battalio

Experience the Build conference on Channel 9 and learn how to build fierce Windows 8 apps using C++ from the experts: Bringing Existing C++ Code to Windows Store Apps, Tarek Madkour, 10/30 11:45am. Beyond just learning how to write apps in C++, you will see how to create new libraries or reuse existing components that you can seamlessly combine with Metro style apps using JavaScr

posted on October 29, 2012 by George Mileka [MSFT]

Hi, my name is George Mileka. I’m a developer on the C++ Libraries team. I have been working on the Project Code Name Austin for many months with Jorge, Eric, and Alan. To learn more about what the Project Code Name Austin is, you can read this great post by Jorge Pereira. For Project Austin, we have used ESE (Extensible Storage Engine) as the storage engine. In this blog post, I will ex

Xeo
Xeo
range_c<int, 0, 2> is [0,2) though aka will only call twice
Oct 30, 2012 16:17
but when it calls f it calls f(2), f(2) I want f(0), f(1), f(2)
user142019
Feeds y u no flood protection. It’s not fair.
sbi
sbi
Well, it's only been 9hrs. I hadn't expect someone to immediately jump at my suggestion when I couldn't make the time myself.
@Zoidberg'-- A lot of the regs have Feeds on ignore.
@Xeo whether its twice or thrice is not a big issue. What I want is. for_each should call f(i) instead of f(n) where i iterates over begining to ending int. Is it doable with range_c ?
Xeo
Xeo
@NeelBasu Working fine over here.
sbi
sbi
Oct 30, 2012 16:21
Sigh. So my reworked trace file mechanism works like a charm. Well, except that it write the trace files backwards, with the oldest line at the top. Oh, and for inexplicable reasons it always keeps N-10 buffers around, rather than N. Also, after a while it crashes because it grabs some place where it isn't allowed to. And I had forgotten how nerve-wrecking it is to have to restart the machine every single time the damn thing crashes, because there's no memory protection between tasks...
I guess I'd better call it a day and go home.
@Xeo I donno Mine is printing 2,2 mine is 1.43 though 'll try copy pasting yours
sbi
sbi
@R.MartinhoFernandes BTW, this was meant as a reply for that. I dunno what happened, but this fuckup fits my day.
@DeadMG wait really?
sbi
sbi
@MooingDuck He has. I know of nobody else. Of course, that doesn't mean there could be others.
@Xeo Isn't that int template parameter ?
sbi
sbi
Oct 30, 2012 16:25
OTOH, when there's Feeds nobody is interested in, the owners could kill those.
Last time I left work with code in a catastrophic state, I didn't get a wink of sleep, which happened to be last night
Is that normal for you guys? It bothers me to no end
Even if it isn't committed
sbi
sbi
@Neil Oh, I have done that a million times, and am used to sleep anyway. I have kids to take care of, and when it's closing time for school/kindergarten/whatever, they don't care whether I have finished some task.
@Neil nope, the instant I stand up to leave my desk, it's gone from my mind.
sbi
sbi
@Neil I might have trouble with it not being committed. What if some accident wipes my HD? I usually commit everything to some branch.
@MooingDuck Well, that doesn't happen to me. I usually keep thinking about what I am hacking at. But I am fine with that, as long as I don't dream about it.
Xeo
Xeo
@NeelBasu ?
sbi
sbi
Oct 30, 2012 16:30
I had such problems before, though, @Neil, more than a decade ago. Sticking to regular hours for work and sleep plus allocating enough free time to be outside, play with the kids, and read books took care of that.
Anyway, time to get outta here, go home, and have dinner with (some of) the kids.
Later.
@MooingDuck Same here.
@Xeo I need 0,1,2 as constant expression
Xeo
Xeo
Okay, what's the code exactly that you're trying to get to work?
boost::mpl::for_each< boost::mpl::range_c<int, 0, T::depth> >( boost::bind(&SelfT::writeHeaderRows< PrinterT, T::depth >, this, boost::ref(stream), boost::ref(printer)) );
Xeo
Xeo
Oct 30, 2012 16:36
Okay, question, why again do you need 0, 1, 2 as a constant expression?
Somehow I want to be able to iterate i over <0 .... T::depth> and I need to pass it as SomeT::ancestorT<i>::Type
Xeo
Xeo
@LuchianGrigore o__o
@Xeo I take it you failed? :P
Xeo
Xeo
No, just my face at the wall 'o text.
Also, it's not closed yet.
@NeelBasu Your code above doesn't even come close to that.
What do you want to do with SomeT::ancestorT<i>::Type?
Oct 30, 2012 16:40
@kbok Woa.
"When writing a specialization,
be careful about its location;
or to make it compile
will be such a trial
as to kindle its self-immolation."

-- ISO C++ Standard, section 14.7.3 [temp.expl.spec], paragraph 7
^ According to Tommy Svensson on Google+
@Xeo That (tries to) calls the function writeHeaderRows<i> that function calls SomeT::ancestorT<i>::Type* a = SomeT::ancestorT<i>::of(node)
@Cheersandhth.-Alf The wording has changed since
Xeo
Xeo
Ah, mpl::for_each will just pass the i as a runtime argument, it's categorized as a runtime algorithm too.
@kbok Nope.
Oct 25 at 23:25, by Xeo
When writing a specialization,
be careful about its location;
or to make it compile
will be such a trial
as to kindle its self-immolation.
/* §14.7.3 [temp.expl.spec] p7 */
@Xeo I is there any compile time alternative ?
or I've to write by My own ?
Xeo
Xeo
Oct 30, 2012 16:43
@NeelBasu Not really, for some reason..
Oh, the first one who found that quote was @LucDanton it seems
Oct 16 '11 at 21:31, by Luc Danton
> When writing a specialization, be careful about its location; or to make it compile will be such a trial as to kindle its self-immolation.
Oct 16 '11
@Xeo for what reason ? isn't it supposed to be simple CRTP ?
Is the nuke building class over?
Xeo
Xeo
@NeelBasu CRTP has... nothing to do with this.
@R.MartinhoFernandes Seems I did find that quote before: chat.stackoverflow.com/transcript/10?m=2124732#2124732
Dec 16 '11
I must have an old version then
@Xeo This compile time iteration can be achived with CRTP
so why there is no such function in mpl ?
Xeo
Xeo
Oct 30, 2012 16:45
@NeelBasu Ehm, CRTP still has nothing to do with compile-time iteration.
@LuchianGrigore I have no idea what you are referring to
I have no problems not committing
It has to be at a somewhat stabile point before I'll commit
> The placement of explicit specialization declarations for function templates, class templates, member functions of class templates, static data members of class templates, member classes of class templates, member class templates of class templates, member function templates of class templates, member functions of member templates of class templates, member functions of member templates of non-template classes, member function templates of member classes of class templates, etc.,
@Xeo why ? I'll do CRTP and decrement enum value do achive this
Isn't that CRTP ?
> and the placement of partial specialization declarations of class templates, member class templates of non-template classes, member class templates of class templates, etc., can affect whether a program is well-formed according to the relative positioning of the explicit specialization declarations and their points of instantiation in the translation unit as specified above and below.
> When writing a specialization, be careful about its location; or to make it compile will be such a trial as to kindle its self-immolation.
Oct 30, 2012 16:46
@Neil commit to personal, not to master
Xeo
Xeo
@NeelBasu template<class T> struct X{}; struct Y : X<Y>{}; // CRTP
Oh, stupid I am
@Xeo Yes Thats CRTP. But I thought even if I recursively decrement enum thats also CRTP
It's just a different formatting.
Xeo
Xeo
Eh, no. That's just a form of self-calling code.
It's not even true recursion. :)
Oct 30, 2012 16:48
@Xeo Oh! Ok. Thanks. But why there is no compile time iterator in mpl ?
@MooingDuck Hah, as if I had such a luxury
@sehe ok... again what?
Xeo
Xeo
@NeelBasu There is one: fold (and its variants).
I thought you were implying there's a dupe of that.
Xeo
Xeo
(note: accumulate is a synonym to fold.)
 
Conversation ended Oct 30, 2012 at 16:50.