home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 32,658 of 33,346   
   Frank Birbacher to All   
   Re: How to partially specialize class te   
   21 Nov 12 12:37:51   
   
   From: bloodymir.crap@gmx.net   
      
   Hi!   
      
   Am 15.11.12 02:02, schrieb Scott Prager:   
   > I have to wonder why you want to specialize for M, but not the   
   > other parameters. For that matter, why specialize for M? Wouldn't   
   > you prefer to just write this?   
   >   
   > struct Arrow { /*...* };   
      
   Hmm, is it actually specializing for M? M should be a free parameter.   
      
   >> template class m, typename B, typename C>   
   >>   
   >> struct Arrow> { /*...*/ };   
   >   
   > This is pretty much what I did in implementing Arrow, too.   
   >   
   >> Any alternatives?   
   >   
   > I don't understand. Doesn't this do exactly what you want? In fact,   
   > isn't it best? You'll already know some of the types for the   
   > internal functions, so you'll have less template bloat. (In terms   
   > of number of lines of code.)   
      
   No, to me it does not. I'm targeting at the following syntax to use   
   some "arrow" function template "timesTwoA":   
      
   template class A> //arrow A   
   A timesTwoA() {...}   
      
   void foo() { timesTwoA>(); }   
      
   > Although, omitting the practicality of how to write Arrow, I have   
   > been pondering whether or not one can partially apply   
   > type-arguments, too, like how a function can be partially applied   
   > arguments with std::bind.   
      
   Yes, that's what I'm trying to do. While a template alias can bind   
   some parameters to fixed types, I'm trying to bind to a non-fixed   
   type. Hopefully I can explain this concept using the following code lines:   
      
   // bind to fixed type boost::optional:   
   template   
   using optionalArrow = Kleisli;   
      
   // bind to free type M:   
   template class M>   
   template   
   using monadArrow = Kleisli;   
      
   // then use it like:   
   timesTwoA>();   
   // and mean:   
   timesTwoA();   
      
   I guess there is no such genericity in template aliases. Mathias   
   suggested the classic approach using a nested template member. But   
   this increases template bloat. I'm trying to find a way around it.   
      
   Frank   
      
   --   
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca