[boost] Re: How Do We Install the Boost FileSystem?
Isadora Kenterly wrote: I posted this question to one of the C++ groups and they treated me as if I were an entity from another planet! The group was comp.lang.c++. The topic there is standard C++ so libraries like boost are off topic If they are in a good mood they'll help but there is no guarantee Is it possible to download and use only the FileSystem of Boost? If it is, how exactly do we install it? You can use the parts independently There is no install required You have the complete code, you include the appropriate header! I don't think there is an easy way of downloading it on it's own (other than getting it straight from the CVS) but you shouldn't need to care since it'll only link the parts you use Boost isn't like most 3rd party libraries in the sense of a dll (or similar) which you download or build and then have to ship and an API to use it. You have the complete code so you can use it as if it was your own! Vin ___ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
[boost] Re: an XML API in boost
What I did was to provide a *thin* wrapper around the internal C strucs used by libxml2, so every dom manipulation call can be delegated down to libxml2. For example xpath lookup: I call libxml2's xpath API, returning me a C structure (possibly) holding a node set, i.e. a list of C nodes. I just need to map these C structs back to my C++ wrapper objects and I'm done with it. (Luckily for me, libxml2 provides all the hooks to make that lookup very efficient...) One problem would be the licence libxml2 is a Gnu project isn't it? that means it's under the Gnu licence which is far more restrictive than the boost licence But as to doing a nice wrapper of some sort it sounds like a good idea ___ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
[boost] Re: class proposal
Justin M. Lewis wrote: Not entirely, passing a pointer doesn't tell you that the parameter will change, it just tells you that it might, it still leaves you in the position of having to track down the function and check it. But outside of that, if you're like me, at this point you prefer references to pointers, whenever possible. I did use references everywhere but changed to pointers for the reason you are talking about I only use pointers if the argument might be changed that way the &varName means varName will be changed in the function if the arg won't be changed I pass const& The only reason for doing this is to make it obvious which are in parameters and which are out\inout using a class just seemed like over kill for something so small Oh well, it is all a matter of taste I suppose Vin ___ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
[boost] Re: Spirit and slow compile (from gmane.comp.lib.boost.devel)
Joel de Guzman wrote: - Original Message - From: <[EMAIL PROTECTED]> Hi, I was talking to you on the boost newsgroup about spirit being slow to compile Here is a standalone section of code, it'll compile but you can't do anything with it The compile takes about 15 mins on my machine (We are using spirit for a second file but that is smaller and only takes a minute or two) The Spec of my machine is P3 833, 512M RAM I'm using NT4 SP6a and VC6 SP4 I split it into a lib and it works fine so the problem is less crucial than it was! [] I have a feeling that the Grammar is just big so it's slow and there may not be any getting around that but let me know if you see anything we are doing wrong [] Indeed! I counted 25 grammars. Wow I'm amazed, some grammars are quite elaborate, even :-) After taking a peek at the grammars, I see one minor and one major code tweaks that should improve both the actual code size and compile time speed. minor: use chlit<> or strlit<> rather than rule whenever possible. (e.g. m_CommaToken) major: I see lots of code duplication. It would be best to factor out common grammar definitions into base definition classes. Example: template struct basic_definition { template basic_definition(GrammarT const& self) { // common definitions } }; Then subclass your grammar definition from this. struct my_grammar : public spirit::grammar { template struct definition : basic_definition { typedef basic_definition base_t; definition(my_grammar const& self) : base_t(self) { } }; }; It would help a lot to factor out the common grammars this way. You can even use multiple inheritance where necessary. I hope this helps. I took the liberty to re-post this to the list in the hope that this simple tip might be useful to others. BTW, in the near future, productions such as: r = a | b | c | d | e... where the alternatives have unambiguous prefixes, example: a = "LINEDESC:" >> ... b = "PAINTDESC:" >> ... can be optimized through Spirit style syntactic predicates. Ahh, finaly BTW, you do not need to wrap str_p("...") inside a lexeme because strlits are implicit lexemes. Regards, Joel de Guzman I'll give it a go :-) Thanks, Vin ___ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Re: [boost] Re: spirit and compile speed
Joel de Guzman wrote: "Vincent Finn" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi, I assume this is the right place to post questions on Spirit now that it is part of boost! If not here, where? There's a Spirit specific mailing list that you can subscribe to here: https://lists.sourceforge.net/lists/listinfo/spirit-general This mailing list is also mirrored in gmane NTTP portal : news://news.gmane.org/gmane.comp.spirit.general I had a look at the mailing list but it comes up as read-only for me for some reason? I am logged in to Source Forge but haven't used it much as for the news group I subscribed to it (it appears in the list of available news groups) but when I try to access it I'm told it doesn't exist on the server ?? I have added 2 parsers to my code base and the compile time (VC6) has gone from 10 mins to 30mins :-( Yes, this is the next battle. How big are your grammars? How many productions? Are you using subrules? Better yet, can I see your code? I can send a stripped down code (it'll take a while to put it together so it'll be next week some time) 3 question on that 1) Would you prefer a direct mail with it or an atachment to the NG? 2) Do you need tgz or is zip fine? 3) Is a VC project file fine to show the compile setting I am using? It would be nice if you can send me a snapshot of your grammars (if possible) with a short main() driver code that invokes the parser(s). I'll also need some more info such as: processor speed and available memory as well as your command line parameters. This will give me some clues on where the compiler is choking. I'm running a P3 866, 512M Ram, NT4 SP6 This is another developers code but I made the call to use Spirit so I have to do the optimising ! so please bear with me if it takes a while for me to split it off :( At the very least, yes, you can separate the parsers from the project. How about writing some wrappers that *hides* the grammars in *.cpp files? You can for example have an opaque API in a header such as: bool parse(char const* source); That seems obvious now that you say it I was thinking in terms of spliting spirit off which causes problems but , as you say, all I need is to build a lib with my parser in so that spirit is hidden. Thanks for the quick response, Vin ___ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
[boost] spirit and compile speed
Hi, I assume this is the right place to post questions on Spirit now that it is part of boost! If not here, where? My question is about compile speed. Is there any way to speed it up or at least seperate it from the project? I have added 2 parsers to my code base and the compile time (VC6) has gone from 10 mins to 30mins :-( I considered building a lib but since it is templates almost all the code is in the header so I can't see the benefit Is there a method that works ??? Vin ___ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
[boost] Optional suggestion
Hi, A thought occurred to me about optional<> This is again about having the constructor non-explicit (I would really like to have this :-) could you use partial specialization to do this ? The code below has the desired behaviour. usage gives the programmer the ability to choose whether the constructor is explicit or not Are there any problems with this approach ? Vin template< typename T, bool bIsExplicit = true > class C { public: C( const T ) { g = 9; }; }; template< typename T > class C< T, true > { public: explicit C( const T ) { g = 2; } }; void test1(C c) { int grr = 90; } void test2(C c) { int grr = 99; } ___ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
[boost] Re: smart_ptr and operator bool
Peter Dimov wrote: From: "Vincent Finn" <[EMAIL PROTECTED]> Hi, A quick question does the latest version of smart_ptr have a bool cast ? Quick answer: yes, it does. http://www.boost.org/libs/smart_ptr/shared_ptr.htm#conversions I read that but the phrase 'unspecified-bool-type' caught me out :-( Thanks :-) ___ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
[boost] smart_ptr and operator bool
Hi, A quick question does the latest version of smart_ptr have a bool cast ? The version I use, 1.22, has an options (define BOOST_SMART_PTR_CONVERSION) but I know this was taken out in later versions There was talk of a safe 'operator bool()' but I don't know if anything came of it! Vin ___ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
[boost] Re: Formal review: Optional library
Douglas Gregor wrote: The formal review of Fernando Cacciola's Optional library begins today and runs until the end of Wednesday, December 18. I would still like a way of having the constructor being implicit so you could use optional for function arguments instead of the pointer syntax but this was discussed at length before and does have problems :-( even without that bit I vote to accept it :-) Vin ___ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
[boost] Re: Formal Review Request: class optional<>
Fernando Cacciola wrote: - Original Message - From: "Vincent Finn" <[EMAIL PROTECTED]> And now the question can this be used with VC6 ? Yes :-)) I've uploaded the new version which compiles and runs properly with VC6.0 Got it, thanks :-) But back to the other point I think it would be nice the have an optional that could be used for nice function arguments (the posts between you and Gennadiy give reaons I hadn't though of) I agree that it can be done using pointers and wrappers but so can the return value, optional is a wrapper for this type of behaviour so having a second wrapper for an almost identical purpose seems bad :-( Would some sort of specialisation be possible ? or a small wrapper class to allow the other syntax while leaving the current (safer) version as default? Vin ___ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
[boost] Re: Formal Review Request: class optional<>
Hi, I have one comment and one question. So first the comment I was recently thinking about a similar thing for a slightly different purpose. You seem to concentrate on option return values, what about optional arguments. e.g. void fn(int iImportant, optional iNotImportant = optional()); The reasoning for this is similar to for the return the function could tell if the user had passed in an argument and act accordingly Normally you can have a special default value but cases can occur where and int is valid but none might be required. The reason I assume you don't allow for this is that your constructor is explicit and for easier calling sytax in this case that would not be best (I think) i.e. I would want to be able to call the above as fn(1, 3); The most common reason, though, would be the desire to use references rather than pointers int fn1(optional iMayNotWant = optional()); instead of int fn2(int* piMayNotWant = NULL); I assume this isn't possible since references aren't default constructable but it would be nice :-) --- And now the question can this be used with VC6 ? I have tried at it won't compile (I'm compiling with boost 1.29) I get the following error in optional optional_detail.hpp(91) : error C2371: 'proxy' : redefinition; different basic types optional_detail.hpp(90) : see declaration of 'proxy' optional_detail.hpp(171) : see reference to class template instantiation 'boost::optional_detail::value_based_optional' being compiled and lots of errors in mpl\logical\and.hpp e.g mpl\logical\and.hpp(115) : error C2039: 'type' : is not a member of '`global namespace'' mpl\logical\and.hpp(115) : error C2146: syntax error : missing ',' before identifier 'value' and a lot more :-( Vin ___ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
[boost] Re: Possible boost addition: sub string and const s tring.
Alexei Novakov wrote: "Vincent Finn" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Forwarded to main Boost list - that's the more appropriate venue for discussions of possible additions. -- Jim Hyslop boost-users moderator. > -Original Message- > From: alexei_novakov [mailto:[EMAIL PROTECTED]] > Sent: Monday, November 18, 2002 7:05 PM > To: [EMAIL PROTECTED] > Subject: [Boost-Users] Possible boost addition: sub string and const > string. > > > Hello everyone. > > I have two classes which I found pretty handy: sub_string (behaves as > a mirror of the portion of master basic_string) and const_string (C- > string wrapper). Nice thing about these two is they implemented as > template specialization of basic_string which has advantages: > a) familiar interface; > b) possibility to reuse the code written for basic_string (like > string streams, lexical casts, etc). > > Any interest? > > Regards. > > Alexei Novakov Sounds interesting, like slice on a valarray When I have to do a lot of manipulation of sub string and can't afford to copy back and forward I normally resort to using vector; this sounds a lot handier How does it work ? Vin The idea is simple. Sub string is declared as basic_string template specialization: template class basic_string > The interfase is the same as for basic_string (except constructors). Sub string instances contain reference to master string and boundaries (start and size). One can use it like this: // Start typedef basic_string sub_string; string str("1234567890"); sub_string ss(str, 2, 5); // master string, start position, size assert(lexical_cast(ss) == 34567); ss = "$$"; assert(str == "12$$890"); // End All the basic_string operators (like +, ==, !=, <, >, <=, >=) are overloaded to be used for both strings and sub strings. Similar approach is used for const_string (C string wrapper), but only const methods of basic_string are implemented. Alexei. Cool, I'd definitely use it Seeing as there is a move to submit a library of string helpers at the moment it might be worth submitting this at the same time! Vin ___ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
[boost] Re: lexical_cast and bool
Neal D. Becker wrote: "Roland" == Roland Richter <[EMAIL PROTECTED]> writes: Roland> Dear all, Roland> just a minor issue for the upcoming(?) lexical_cast in 1.30.0: Roland> lexical_cast( "true" ) returns false, Roland> since std::ios::boolalpha is not set by default. Roland> How about changing this? I believe we need a mechanism to set all the flags, not just this one. true I have altered my copy of the file with boolalpha but I always have to go back to the stream if I want to do hex being able to set fill, precision etc... would be nice too No simple generic way to do it that I could think of though :-( Vin ___ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
[boost] Re: Possible boost addition: sub string and const s tring.
Forwarded to main Boost list - that's the more appropriate venue for discussions of possible additions. -- Jim Hyslop boost-users moderator. > -Original Message- > From: alexei_novakov [mailto:[EMAIL PROTECTED]] > Sent: Monday, November 18, 2002 7:05 PM > To: [EMAIL PROTECTED] > Subject: [Boost-Users] Possible boost addition: sub string and const > string. > > > Hello everyone. > > I have two classes which I found pretty handy: sub_string (behaves as > a mirror of the portion of master basic_string) and const_string (C- > string wrapper). Nice thing about these two is they implemented as > template specialization of basic_string which has advantages: > a) familiar interface; > b) possibility to reuse the code written for basic_string (like > string streams, lexical casts, etc). > > Any interest? > > Regards. > > Alexei Novakov Sounds interesting, like slice on a valarray When I have to do a lot of manipulation of sub string and can't afford to copy back and forward I normally resort to using vector; this sounds a lot handier How does it work ? Vin ___ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost