Re: For 0.9? Avoiding string copy
Kristoffer Danielsson <[email protected]>
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <[email protected]> |
Hmm... obviously, I included windows.h and min() and max() were defined. I believe you can patch luabind to explicitly not use these defines, as described here: http://article.gmane.org/gmane.comp.lang.lua.bind.user/939 From: [email protected] To: [email protected] Date: Sat, 12 Dec 2009 21:24:00 +0100 Subject: Re: [luabind] For 0.9? Avoiding string copy I tried your code with 0.9 and got a lot of compilation errors. What did I do wrong? luabind\luabind\detail\inheritance.hpp(21) : warning C4003: not enough actual parameters for macro 'max' luabind\luabind\detail\inheritance.hpp(21) : error C2589: '(' : illegal token on right side of '::' luabind\luabind\detail\inheritance.hpp(21) : error C2059: syntax error : '::' luabind\luabind\detail\inheritance.hpp(21) : error C2059: syntax error : ')' luabind\luabind\detail\inheritance.hpp(21) : error C2059: syntax error : ')' luabind\luabind\detail\call.hpp(54) : warning C4003: not enough actual parameters for macro 'max' luabind\luabind\detail\call.hpp(53) : error C2589: '(' : illegal token on right side of '::' luabind\luabind\detail\call.hpp(53) : error C2143: syntax error : missing ')' before '::' luabind\luabind\detail\call.hpp(53) : error C2612: trailing '::' illegal in base/member initializer list luabind\luabind\detail\call.hpp(53) : error C2589: '(' : illegal token on right side of '::' luabind\luabind\detail\call.hpp(53) : error C2143: syntax error : missing ';' before '::' luabind\luabind\detail\call.hpp(53) : error C2059: syntax error : ')' luabind\luabind\detail\call.hpp(56) : error C2143: syntax error : missing ';' before '{' luabind\luabind\detail\call.hpp(70) : error C2951: template declarations are only permitted at global, namespace, or class scope luabind\luabind\detail\call.hpp(79) : error C2888: 'int invoke0(lua_State *,const luabind::detail::function_object &,luabind::detail::invoke_context &,const F &,Signature,const Policies &,IsVoid,boost::mpl::true_)' : symbol cannot be defined within namespace 'detail' luabind\luabind\detail\call.hpp(79) : fatal error C1506: unrecoverable block scoping error Thanks! > Date: Wed, 9 Dec 2009 17:58:01 +0100 > From: [email protected] > To: [email protected] > Subject: Re: [luabind] For 0.9? Avoiding string copy > > Kristoffer Danielsson wrote: > > Any chance you could add such a wrapper for 0.9? It's really painful > > to copy strings that do not need to be copied! > > 0.9 is (mostly) in feature freeze, so I won't add anything like that at > least for now. You can easily do it by yourself though: > > struct cstring_with_length > { > cstring_with_length(char const* s, std::size_t len) > : s(s) > , len(len) > {} > > char const* s; > std::size_t len; > }; > > namespace luabind > { > > template <> > struct default_converter<cstring_with_length> > : native_converter_base<cstring_with_length> > { > void to(lua_State* L, cstring_with_length const& str) > { > lua_pushlstring(L, str.s, str.len); > } > }; > > } // namespace luabind > > -- > Daniel Wallin > BoostPro Computing > http://www.boostpro.com > > ------------------------------------------------------------------------------ > Return on Information: > Google Enterprise Search pays you back > Get the facts. > http://p.sf.net/sfu/google-dev2dev > _______________________________________________ > luabind-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/luabind-user Hitta kärleken! Klicka här Hitta en dator som passar dig! _________________________________________________________________ Nya Windows 7 - Hitta en dator som passar dig! Mer information. http://windows.microsoft.com/shop ------------------------------------------------------------------------------ Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev _______________________________________________ luabind-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/luabind-user