Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost-users Digest, Vol 2679, Issue 1
From: Shah, Gaurav N (gaurav.n.shah_at_[hidden])
Date: 2011-04-01 04:09:01


Thanks Andreas Wehrmann. if worked after including boost/function.hpp. I am still wondering what changes boost has made while moving from 1.41 to 1.44 that has made users to explicitly include "function.hpp" This code was compiling with 1.41 without including boost/function.hpp Thank You, Gaurav -----Original Message----- From: boost-users-bounces_at_[hidden] [mailto:boost-users-bounces_at_[hidden]] On Behalf Of boost-users-request_at_[hidden] Sent: Friday, April 01, 2011 11:34 AM To: boost-users_at_[hidden] Subject: Boost-users Digest, Vol 2679, Issue 1 Send Boost-users mailing list submissions to boost-users_at_[hidden] To subscribe or unsubscribe via the World Wide Web, visit http://lists.boost.org/mailman/listinfo.cgi/boost-users or, via email, send a message with subject or body 'help' to boost-users-request_at_[hidden] You can reach the person managing the list at boost-users-owner_at_[hidden] When replying, please edit your Subject line so it is more specific than "Re: Contents of Boost-users digest..." Today's Topics: 1. Re: [boost::mutex] Do they block or wait? (Ovanes Markarian) 2. Re: [Lambda] nitty gritty detail...? (Robert Jones) 3. Re: [Lambda] nitty gritty detail...? (Steven Watanabe) 4. VS2010+boost 1.44 - error in move.hpp (archie14) 5. [boost] [program options] Potential bug in parsing arguments where one is suffix of the other ? (Sanjit Jhala) 6. [MPL] no invoke<T>? (Noah Roberts) 7. Re: Problem with gcc/4.5.0-g++and boost::function (Andreas Wehrmann) ---------------------------------------------------------------------- Message: 1 Date: Thu, 31 Mar 2011 20:21:29 +0200 From: Ovanes Markarian <om_boost_at_[hidden]> To: boost-users_at_[hidden] Subject: Re: [Boost-users] [boost::mutex] Do they block or wait? Message-ID: <AANLkTim_=MZAk0WwoerK7-TCRAGpN0Gdgcr+DDV5uhOA_at_[hidden]> Content-Type: text/plain; charset="iso-8859-1" On Thu, Mar 31, 2011 at 7:49 PM, Steven Watanabe <watanabesj_at_[hidden]>wrote: > AMDG > > > On 03/31/2011 09:55 AM, Panagiotis Foteinos wrote: > >> I looked into the documentation, but it is still unclear to me. >> >> [...] > > boost's locking mechanism >> blocking or spinning? >> >> > It's an implementation detail. You realize that the > two aren't necessarily mutually exclusive? Anyway, > Boost.Thread does block on an Event. A spin-lock > only makes sense on a multi-core system. > > In Christ, > Steven Watanabe > As Steven pointed out it is an implementation detail and these two concepts might be used together (primarily for optimization). Switching to kernel mode (e.g. dealing with kernel objects like event, mutex, semaphore through system calls) is a very time costly operation, therefore some libs provide spinning optimizations, which do spinning (for some few cpu cycles) and if they are still unable to acquire a lock, they make a system call which changes into the kernel mode and finally puts the thread into the blocked state if the object is still not available (signaled, unlocked etc). But even so it is not black and white in the concurrency world. :( Some would like to achieve speed through such an optimization others would like to get rid of such an optimization. A good example might be an embedded app running on a battery driven HW, where energy plays a major role. Here wasting CPU cycles for speed optimization might not be a good idea... But anyway that should be separately evaluated. With Kind Regards, Ovanes -------------- next part -------------- HTML attachment scrubbed and removed ------------------------------ Message: 2 Date: Thu, 31 Mar 2011 19:27:30 +0100 From: Robert Jones <robertgbjones_at_[hidden]> To: boost-users_at_[hidden] Subject: Re: [Boost-users] [Lambda] nitty gritty detail...? Message-ID: <AANLkTinfsOJmqrWBP16+7s2c+YufKcW3GwcHapxttLqq_at_[hidden]> Content-Type: text/plain; charset="iso-8859-1" On Thu, Mar 31, 2011 at 4:47 PM, Steven Watanabe <watanabesj_at_[hidden]>wrote: > AMDG > > > On 03/31/2011 08:29 AM, Robert Jones wrote: > >> From Bjorn Karlsson's book, P297... >>> >> >> int i; >> int value = 12; >> var(i) = ( if_then_else_return( _1>=10, constant(10),_1) )(value); >> >> Why does the assignment LHS need to be wrapped in var()? >> >> > Because operator= must be a member function. > > Nope, still not getting it! Stop me when I err... if_then_else_return(...) defines a unary functor it_then_else_return(...)( value) evaluates that functor, and returns what? Some type of integer I think? So doesn't the assignment simply perform assignment of an integer, by copy? And that doesn't need operator= to a member of anything? Thanks - R. -------------- next part -------------- HTML attachment scrubbed and removed ------------------------------ Message: 3 Date: Thu, 31 Mar 2011 11:38:33 -0700 From: Steven Watanabe <watanabesj_at_[hidden]> To: boost-users_at_[hidden] Subject: Re: [Boost-users] [Lambda] nitty gritty detail...? Message-ID: <4D94CA29.9060307_at_[hidden]> Content-Type: text/plain; charset=ISO-8859-1; format=flowed AMDG On 03/31/2011 11:27 AM, Robert Jones wrote: > On Thu, Mar 31, 2011 at 4:47 PM, Steven Watanabe<watanabesj_at_[hidden]>wrote: >> >> On 03/31/2011 08:29 AM, Robert Jones wrote: >> >>> From Bjorn Karlsson's book, P297... >>>> >>> >>> int i; >>> int value = 12; >>> var(i) = ( if_then_else_return( _1>=10, constant(10),_1) )(value); >>> >>> Why does the assignment LHS need to be wrapped in var()? >>> >>> >> Because operator= must be a member function. >> >> > Nope, still not getting it! Stop me when I err... > > if_then_else_return(...) defines a unary functor > it_then_else_return(...)( value) evaluates that functor, and returns what? > > Some type of integer I think? Yes. > So doesn't the assignment simply perform > assignment of an integer, by copy? And that doesn't need operator= to > a member of anything? > Oh, I see. As written, the code doesn't make much sense, so my mind automatically translated it into (var(i) = if_then_else_return( _1>=10, constant(10),_1) )(value); In Christ, Steven Watanabe ------------------------------ Message: 4 Date: Thu, 31 Mar 2011 22:56:11 +0000 (UTC) From: archie14 <admin_at_[hidden]> To: boost-users_at_[hidden] Subject: [Boost-users] VS2010+boost 1.44 - error in move.hpp Message-ID: <loom.20110401T005027-111_at_[hidden]> Content-Type: text/plain; charset=us-ascii While compiling the project in VS2010 previously built without errors in VS2008 I am getting following error: c:\libraries\boost\boost_1_44_0\boost\interprocess\detail\move.hpp(342): error C2440: 'return' : cannot convert from 'boost::interprocess::file_mapping' to 'boost::interprocess::file_mapping &&' You cannot bind an lvalue to an rvalue reference c:\libraries\boost\boost_1_44_0\boost\interprocess\file_mapping.hpp (62) : see reference to function template instantiation 'boost::interprocess::file_mapping &&boost::interprocess::move<boost::interprocess::file_mapping&>(T)' being compiled with [ T=boost::interprocess::file_mapping & ] I tried to search the forum for the reports on this error and did not find anything. I'll appreciate any help in this matter. ------------------------------ Message: 5 Date: Thu, 31 Mar 2011 16:16:25 -0700 From: Sanjit Jhala <sjhalaz_at_[hidden]> To: boost-users_at_[hidden] Subject: [Boost-users] [boost] [program options] Potential bug in parsing arguments where one is suffix of the other ? Message-ID: <AANLkTi=bEJWMhNj-wO-9O6SjHORiGkr0xn75pKeJOU4=@mail.gmail.com> Content-Type: text/plain; charset="iso-8859-1" Hi, I have the following code (modified from example/first.cpp): *#include <boost/program_options.hpp>* *#include <string>* *#include <vector>* *#include <iostream>* * * *namespace po = boost::program_options;* * * *using namespace std;* * * *typedef vector<string> Strings;* * * *// A helper function to simplify the main part.* *template<class T>* *ostream& operator<<(ostream& os, const vector<T>& v)* *{* * copy(v.begin(), v.end(), ostream_iterator<T>(cout, " "));* * return os; * *}* * * * * *int main(int argc, char *argv[]) {* * * * po::options_description cmdline_desc("Usage: %s [Options] [args]\nOptions");* * cmdline_desc.add_options()* * ("str", po::value< string >(), "a string arg")* * ("strs", po::value< Strings >(), "a list of strings")* * ("foo", po::value< string >(), "a string arg")* * ("bar", po::value< Strings >(), "a list of strings")* * ; * * * * po::variables_map vm; * * po::store(po::parse_command_line(argc, argv, cmdline_desc), vm);* * po::notify(vm);* * * * if (vm.count("str"))* * cout << "Got str arg=" << vm["str"].as< string >() << "\n";* * if (vm.count("strs"))* * cout << "Got strs arg=" << vm["strs"].as< Strings >() << "\n";* * if (vm.count("foo"))* * cout << "Got foo arg=" << vm["foo"].as< string >() << "\n";* * if (vm.count("bar"))* * cout << "Got bar arg=" << vm["bar"].as< Strings >() << "\n";* *}* * * When I run the program I see: *./po_test --str "a string" --strs "a, vector, of, strings" --foo "a foo" --bar "a, bar"* *Got strs arg=a string a, vector, of, strings * *Got foo arg=a foo* *Got bar arg=a, bar * It appears the parser is getting confused between the "str" and the "strs". It doesn't seem to be related to ambiguity in handling vectors since the "foo" and "bar" arguments are fine. I see this problem on 32-bit CentOS and Ubuntu machines, but not on 64-bit. I am running Boost 1.43 and from the /usr/local/include/boost/program_options/version.hpp: #define BOOST_PROGRAM_OPTIONS_VERSION_HPP_VP_2004_04_05 #define BOOST_PROGRAM_OPTIONS_VERSION 2 Is this a bug or a expected behaviour? -Sanjit -------------- next part -------------- HTML attachment scrubbed and removed ------------------------------ Message: 6 Date: Thu, 31 Mar 2011 16:32:13 -0700 From: Noah Roberts <roberts.noah_at_[hidden]> To: boost-users_at_[hidden] Subject: [Boost-users] [MPL] no invoke<T>? Message-ID: <in32tm$6u3$1_at_[hidden]> Content-Type: text/plain; charset=ISO-8859-1; format=flowed I had to write an invoke metafunction because I couldn't seem to find one that looked like it was what I needed: template < typename MF > struct invoke { typedef typename MF::type type; }; I've looked through the documentation TOC: http://www.boost.org/doc/libs/1_42_0/libs/mpl/doc/refmanual/refmanual_toc.html Is there something I'm missing? ------------------------------ Message: 7 Date: Fri, 01 Apr 2011 08:04:18 +0200 From: Andreas Wehrmann <a.wehrmann_at_[hidden]> To: boost-users_at_[hidden] Subject: Re: [Boost-users] Problem with gcc/4.5.0-g++and boost::function Message-ID: <4D956AE2.4040808_at_[hidden]> Content-Type: text/plain; charset=ISO-8859-1; format=flowed On 03/31/2011 06:42 PM, Steven Watanabe wrote: > AMDG > > On 03/31/2011 09:27 AM, Shah, Gaurav N wrote: >> I have legacy code in my library using boost::function. This works >> fine if I am using gcc/4.2.2-g++ and BOOST/1.41. But if I switch >> myself to using gcc/4.5.0-g++ and BOOST/1.44 I get below ERROR: >> I do not see anything wrong with code. >> >> /export/home/a_besnad/Perforce/eq-thebeast-build-linux-Beast_8.08/TheBeast/marketdata/IMDMXP/server/wombat/management.hpp:69:51: >> error: 'function' in namespace 'boost' does not name a type >> /export/home/a_besnad/Perforce/eq-thebeast-build-linux-Beast_8.08/TheBeast/marketdata/IMDMXP/server/wombat/management.hpp:69:58: >> error: ISO C++ forbids declaration of 'parameter' with no type >> /export/home/a_besnad/Perforce/eq-thebeast-build-linux-Beast_8.08/TheBeast/marketdata/IMDMXP/server/wombat/management.hpp:69:66: >> error: expected ',' or '...' before '<' token >> ../../../../../../marketdata/IMDMXP/server/wombat/management.cpp:126:10: >> error: prototype for 'void datasource::management::stop(const >> std::string&, const boost::function<void()>&)' does not match any in >> class 'datasource::management' >> /export/home/a_besnad/Perforce/eq-thebeast-build-linux-Beast_8.08/TheBeast/marketdata/IMDMXP/server/wombat/management.hpp:69:14: >> error: candidate is: void datasource::management::stop(const >> std::string&, int) >> make[6]: *** [management.lo] Error 1 >> make[6]: *** Waiting for unfinished jobs.... >> >> >> >> Code lines throw ERROR: >> >> 68 */ >> 69 void stop(const std::string& topic, const >> boost::function< void (void)>& action); >> 70 >> >> Thanks for help in advance. >> > > Have you verified that boost/function.hpp > is #included? > > In Christ, > Steven Watanabe > _______________________________________________ > Boost-users mailing list > Boost-users_at_[hidden] > http://lists.boost.org/mailman/listinfo.cgi/boost-users This is the first thing I would check, since the compiler has become stricter, meaning indirect inclusions won't work anymore. I ran across the same problem when upgrading from 4.2.x to 4.4.x and 4.5.x respectively. Regards, Andreas -- Dipl.-Ing. (FH) Andreas Wehrmann Software Development -------------------------------------------------------------- Center Communication Systems GmbH A-1210 Wien, Ignaz-K?ck-Stra?e 19 Sitz in Wien FN 796 88p, Firmenbuchgericht Wien www.centersystems.com Tel.: +43 (0) 190 199 - 3616 Mobile: +43 (0) 664 884 75916 Fax: +43 (0) 190 199 - 2110 E-Mail: a.wehrmann_at_[hidden] ------------------------------ _______________________________________________ Boost-users mailing list Boost-users_at_[hidden] http://lists.boost.org/mailman/listinfo.cgi/boost-users End of Boost-users Digest, Vol 2679, Issue 1 ******************************************** This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates. This transmission may contain information that is privileged, confidential, legally privileged, and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to European legal entities.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net