From: Dean M. B. <mik...@gm...> - 2007-06-12 01:24:50
|
Hi Christian, On 6/11/07, Christian Henning <chh...@gm...> wrote: > Hi Dean, I think the MS compiler is right. Defining a variable extern > means it has external linkage. We shouldn't try to be "too smart" in > fooling the compiler. This code can break with every new compiler > version. > Although it does make sense that extern will cause for compilation/linking to require that the object be allocated somewhere, if you check the code again for the transform template method, it doesn't use the extern variables. template <class Algorithm, class Selector> inline impl::transform_impl<Algorithm, Selector> transform(Algorithm, Selector) { return impl::transform_impl<Algorithm, Selector>(); }; That means, when transform(to_header_, source_) is called, nothing should require linkage to to_header_ and source_ since transform(...) doesn't use it (but the type information) anywhere. > I don't see it as a problem when using parenthesis. boost::gil does > something similar > > channel_t& c = get_color( pixel, red_t() ); > True, but this doesn't scale well when we start implementing stuff like operator&, operator|, and other operator overloads. > But if you don't like that then there are other ways, like using an > enum ( I know it's old school ) or use total template specialization. > I'm sure there are other ways. > Total template specialization doesn't make sense yet, especially if there's no _easy_ way of invoking transform(...) with placeholders. Enums are out of the question. ;-) I guess what I'm really looking for is how boost::bind's _1, _2, _N works... :-D -- Dean Michael C. Berris http://cplusplus-soup.blogspot.com/ mikhailberis AT gmail DOT com +63 928 7291459 |