From: Christian H. <chh...@gm...> - 2007-06-11 14:59:32
|
Dean, I just put a typedef on front of: typedef to_upper_placeholder to_upper_; typedef selectors::source_selector source_; typedef selectors::destination_selector destination_; I changed the test code to: msg << transform(to_upper_(), source_()); And there were no problems. Does that makes sense to you? Christian On 6/11/07, Christian Henning <chh...@gm...> wrote: > Dean, if you remove the extern specifier it compiles fine on my > machine. I'm using MSVC 7.1. Why did you decided to implement it this > way? Is it possible to just typedef this information? > > Thanks, > Christian > > > > On 6/11/07, Dean Michael Berris <mik...@gm...> wrote: > > Hi Everyone, > > > > I've only recently been developing with MSVC, and while I've been > > trying to implement the transformations to the message class I hit a > > nasty snag. Let me identify what the problem is. > > > > First, in boost/network/message/transformers/to_upper.hpp I have the following: > > > > struct to_upper_placeholder { > > template <class Selector> > > struct type : public impl::to_upper_transformer<Selector> { }; > > } ; > > > > extern to_upper_placeholder to_upper_; > > > > I also have in boost/network/message/transformers/selectors.hpp: > > > > namespace selectors { > > struct source_selector { }; > > struct destination_selector { }; > > }; // namespace selectors > > > > extern selectors::source_selector source_; > > extern selectors::destination_selector destination_; > > > > What I'm concerned about, is that the MSVC linker keeps asking for > > where to look for these externs when I have the following function > > template in boost/network/transformers.hpp : > > > > > > template <class Algorithm, class Selector> > > inline impl::transform_impl<Algorithm, Selector> > > transform(Algorithm, Selector) { > > return impl::transform_impl<Algorithm, Selector>(); > > }; > > > > This is used in the unit test (which fails to compile in MSVC 8) > > libs/network/test/message_transform_test.cpp : > > > > using namespace boost::network; > > > > message msg; > > msg << source("me"); > > BOOST_CHECK_EQUAL ( source(msg), "me" ); > > msg << transform(to_upper_, source_); > > BOOST_CHECK_EQUAL ( source(msg), "ME" ); > > > > Clearly, the 'transform' template method only requires the type > > information of to_upper_ (an extern to_upper_placeholder) and source_ > > (an extern selectors::source_selector) but MSVC seems to require that > > they be linkable from somewhere. > > > > Any thoughts on the matter? I haven't tried this in GCC yet, but I'm > > confident that GCC would know that I don't really need to link to > > these instances -- that I just need the type to be deduced in the > > 'transform' template and not care about the actual instances. > > > > Help and insight would be most appreciated. > > > > Thanks and hope to hear from any one of you soon! > > > > (Please update to Revision 17 to get the latest unit tests and > > implementations from trunk/) > > > > -- > > Dean Michael C. Berris > > http://cplusplus-soup.blogspot.com/ > > mikhailberis AT gmail DOT com > > +63 928 7291459 > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by DB2 Express > > Download DB2 Express C - the FREE version of DB2 express and take > > control of your XML. No limits. Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > _______________________________________________ > > Cpp-netlib-devel mailing list > > Cpp...@li... > > https://lists.sourceforge.net/lists/listinfo/cpp-netlib-devel > > > |