Search Results

Search found 1949 results on 78 pages for 'boost spirit'.

Page 18/78 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • C++ volatile required when spinning on boost::shared_ptr operator bool()?

    - by JaredC
    I have two threads referencing the same boost::shared_ptr: boost::shared_ptr<Widget> shared; On thread is spinning, waiting for the other thread to reset the boost::shared_ptr: while(shared) boost::thread::yield(); And at some point the other thread will call: shared.reset(); My question is whether or not I need to declare the shared pointer as volatile to prevent the compiler from optimizing the call to shared.operator bool() out of the loop and never detecting the change? I know that if I were simply looping on a variable, waiting for it to reach 0 I would need volatile, but I'm not sure if boost::shared_ptr is implemented in such a way that it is not necessary here.

    Read the article

  • Looking for mpic++

    - by unknownthreat
    I am following instructions at http://www.boost.org/doc/libs/1_43_0/doc/html/mpi/getting_started.html#mpi.config trying to build Boost MPI .lib files, but I got one problem: I do not have mpic++. Looking at the MPI implementation files such as MPICH2 and Open MPI, I see no mpic++ included at all. Where can I find mpic++?

    Read the article

  • Intel Core i5-2467m - Turbo Boost not activating?

    - by Trevor Sullivan
    I have a Samsung Series 5 laptop with an Intel Core i5-2467m process @ 1.6Ghz. The processor supports Intel Turbo Boost up to 2.30 Ghz according to the specifications. The i5-2467m is a dual-core process with HyperThreading, so there is a total of four (4) virtual cores in Windows 7 SP1. http://ark.intel.com/products/56858/ I've installed the Intel Turbo Boost Technology Monitor v2.6 to monitor if Turbo Boost is enabled, and set it to "Always On Top." I followed this process to max out the CPU: Open (4x) PowerShell instances Set each instance's affinity to a distinct CPU vCore Ran this code in each instance: while (1 -eq 1) { } Unfortunately, after maxing out all 4 cores, my laptop got hot, but Turbo Boost never kicked in. Any ideas on how to ensure that I'm getting the 2.3Ghz Turbo Boost capability of my laptop?

    Read the article

  • Copy vector of values to vector of pairs in one line

    - by Kirill V. Lyadvinsky
    I have the following types: struct X { int x; X( int val ) : x(val) {} }; struct X2 { int x2; X2() : x2() {} }; typedef std::pair<X, X2> pair_t; typedef std::vector<pair_t> pairs_vec_t; typedef std::vector<X> X_vec_t; I need to initialize instance of pairs_vec_t with values from X_vec_t. I use the following code and it works as expected: int main() { pairs_vec_t ps; X_vec_t xs; // this is not empty in the production code ps.reserve( xs.size() ); { // I want to change this block to one line code. struct get_pair { pair_t operator()( const X& value ) { return std::make_pair( value, X2() ); } }; std::transform( xs.begin(), xs.end(), back_inserter(ps), get_pair() ); } return 0; } What I'm trying to do is to reduce my copying block to one line with using boost::bind. This code is not working: for_each( xs.begin(), xs.end(), boost::bind( &pairs_vec_t::push_back, ps, boost::bind( &std::make_pair, _1, X2() ) ) ); I know why it is not working, but I want to know how to make it working without declaring extra functions and structs?

    Read the article

  • Linker problem linking boost in Visual Studio 2008

    - by Tobias Langner
    Hi, I have a rather obscure linking problem in Visual Studio 2008. The linker error message is: "LNK1104: cannot open file 'boost_thread-vc90-mt-gd-1_38.lib'". All pathes and dependencies are set. What I noticed though is that Visual Studio misses boost_thread-vc90-mt-gd-1_38.lib and not libboost_thread-vc90-mt-gd-1_38.lib (notice the lib at the beginning of the file name). I added the .lib as libboost_thread-vc90-mt-gd-1_38.lib to the project and it appears as libboost_thread-vc90-mt-gd-1_38.lib in the command line. Why does Visual Studio the beginning of the file name?

    Read the article

  • boost ublas: rotate 2d vector

    - by AndreasT
    Erm. I hope I am seriously overlooking something. I want to rotate a 2d vector (kartesian) v by a certain angle phi. I can't find a function that generates the appropriate matrix or just performs that function. I know how to do this by hand. I am looking for a ublas utility "something" that does this for me.

    Read the article

  • boost graph adjacency_list, retrieving a node's parents

    - by Juan
    I want to find in an adjacency graph from the bgl how give a Vertexdescriptor and get the set of nodes that are parents of this given node. i would like to do this in directed graph, it seems you could use a bidirectional graph but i want to be able to restrict it so that there are no cycles.

    Read the article

  • Partial string search in boost::multi_index_container

    - by user361699
    I have a struct to store info about persons and multi_index_contaider to store such objects struct person { std::string m_first_name; std::string m_last_name; std::string m_third_name; std::string m_address; std::string m_phone; person(); person(std::string f, std::string l, std::string t = "", std::string a = DEFAULT_ADDRESS, std::string p = DEFAULT_PHONE) : m_first_name(f), m_last_name(l), m_third_name(t), m_address(a), m_phone(p) {} }; typedef multi_index_container , ordered_non_unique, member, member persons_set; operator< and operator<< implementation for person bool operator<(const person &lhs, const person &rhs) { if(lhs.m_last_name == rhs.m_last_name) { if(lhs.m_first_name == rhs.m_first_name) return (lhs.m_third_name < rhs.m_third_name); return (lhs.m_first_name < rhs.m_first_name); } return (lhs.m_last_name < rhs.m_last_name); } std::ostream& operator<<(std::ostream &s, const person &rhs) { s << "Person's last name: " << rhs.m_last_name << std::endl; s << "Person's name: " << rhs.m_first_name << std::endl; if (!rhs.m_third_name.empty()) s << "Person's third name: " << rhs.m_third_name << std::endl; s << "Phone: " << rhs.m_phone << std::endl; s << "Address: " << rhs.m_address << std::endl; return s; } Add several persons into container: person ("Alex", "Johnson", "Somename"); person ("Alex", "Goodspeed"); person ("Petr", "Parker"); person ("Petr", "Goodspeed"); Now I want to find person by lastname (the first member of the second index in multi_index_container) persons_set::nth_index<1::type &names_index = my_set.get<1(); std::pair::type::const_iterator, persons_set::nth_index<1::type::const_iterator n_it = names_index.equal_range("Goodspeed"); std::copy(n_it.first ,n_it.second, std::ostream_iterator(std::cout)); It works great. Both 'Goodspeed' persons are found. Now lets try to find person by a part of a last name: std::pair::type::const_iterator, persons_set::nth_index<1::type::const_iterator n_it = names_index.equal_range("Good"); std::copy(n_it.first ,n_it.second, std::ostream_iterator(std::cout)); This returns nothing, but partial string search works as a charm in std::set. So I can't realize what's the problem. I only wraped strings by a struct. May be operator< implementation? Thanks in advance for any help.

    Read the article

  • C++ boost thread id and Singleton

    - by aaa
    hi. Sorry to flood so many questions this week. I assume thread index returned by thread.get_id is implementation specific. In case of the pthreads, is index reused? IE, if thread 0 runs and joins, is thread launched afterwords going to have a different ID? the reason I ask this is a need to implement Singleton pattern with a twist: each thread gets its own instance. I know it sounds very crazy, but threads control hardware (cuda) which does not permit device memory sharing. What is a good way to implement such pattern?

    Read the article

  • Boost ForEach Question

    - by bobber205
    Trying to use something like the below with a char array but it doesn't compile. But the example with short[] works fine. Any idea why? :) char someChars[] = {'s','h','e','r','r','y'}; BOOST_FOREACH(char& currentChar, someChars) { } short array_short[] = { 1, 2, 3 }; BOOST_FOREACH( short & i, array_short ) { ++i; }

    Read the article

  • D_WIN32_WINNT compiler warning with Boost

    - by bobber205
    Not sure what to make of this error. Added -D_WIN32_WINNT=0x0501 to Visual Studio's "Command Line" options under Project Properties but it says it doesn't recognize it and the warning still appears. I am also not sure how to add the Preprocessor Definition. :) Thanks for any help! 1Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example: 1- add -D_WIN32_WINNT=0x0501 to the compiler command line; or 1- add _WIN32_WINNT=0x0501 to your project's Preprocessor Definitions.

    Read the article

  • accumulator don't compile

    - by Abruzzo Forte e Gentile
    HI All I am using boost accumulators. These 2 lines use to work fine with current version of boost in LInux. accumulator_set< double, stats< tag::covariance<double, tag::covariate1> > > acc_cov; accumulator_set< double, stats< tag::variance > > acc_var; When I moved to a Sun machine where it is installed boost v1.40 I have this building error "/opt/boost/boost/accumulators/framework/depends_on.hpp", line 276: Error:<no tag> cannot be initialized in a constructor. "/opt/boost/boost/fusion/container/list/cons.hpp", line 85: Where: While instantiating "boost::accumulators::detail::accumulator_wrapper<int, int>::accumulator_wrapper(const boost::accumulators::detail::accumulator_wrapper<int, int>&)". "/opt/boost/boost/fusion/container/list/cons.hpp", line 85: Where: Instantiated from non-template code. 1 Error(s) Do you know how can I fix those errors and why I have this issue? Thanks AFG

    Read the article

  • Can I mix compile time string comparison with MPL templates?

    - by Negative Zero
    I got this compile time string comparison from another thread using constexpr and C++11 (http://stackoverflow.com/questions/5721813/compile-time-assert-for-string-equality). It works with constant strings like "OK" constexpr bool isequal(char const *one, char const *two) { return (*one && *two) ? (*one == *two && isequal(one + 1, two + 1)) : (!*one && !*two); } I am trying to use it in the following context: static_assert(isequal(boost::mpl::c_str<boost::mpl::string<'ak'>>::value, "ak"), "should not fail"); But it gives me an compilation error of static_assert expression is not an constant integral expression. Can I do this?

    Read the article

  • How might I assume a "default value" when parsing using boost::spirit?

    - by tJener
    Let's say I have a grammar defined to something like: a b c d where c, and d are optional and default to 14 if not given. Can I get it to automatically return the 14 if the value isn't given? The closest I've come is like the following: qi::rule<Iterator, std::vector<int>(), ascii::space_type> some_rule; some_rule %= >> int_ >> int_ >> -int_ >> -int_; // ... some_other_rule = some_rule[&some_callback_for_int_vectors]; which will then get 0 for the optional values that didn't show up (I believe). I then change consecutive 0s at the end into 14. Not only is this horribly wrong, but its also just not elegant. Is there a better way to do this?

    Read the article

  • Boost Netbook Speed with an SD Card & ReadyBoost

    - by Matthew Guay
    Looking for a way to increase the performance of your netbook?  Here’s how you can use a standard SD memory card or a USB flash drive to boost performance with ReadyBoost. Most netbooks ship with 1Gb of Ram, and many older netbooks shipped with even less.  Even if you want to add more ram, often they can only be upgraded to a max of 2GB.  With ReadyBoost in Windows 7, it’s easy to boost your system’s performance with flash memory.  If your netbook has an SD card slot, you can insert a memory card into it and just leave it there to always boost your netbook’s memory; otherwise, you can use a standard USB flash drive the same way. Also, you can use ReadyBoost on any desktop or laptop; ones with limited memory will see the most performance increase from using it. Please Note:  ReadyBoost requires at least 256Mb of free space on your flash drive, and also requires minimum read/write speeds.  Most modern memory cards or flash drives meet these requirements, but be aware that an old card may not work with it. Using ReadyBoost Insert an SD card into your card reader, or connect a USB flash drive to a USB port on your computer.  Windows will automatically see if your flash memory is ReadyBoost capable, and if so, you can directly choose to speed up your computer with ReadyBoost. The ReadyBoost settings dialog will open when you select this.  Choose “Use this device” and choose how much space you want ReadyBoost to use. Click Ok, and Windows will setup ReadyBoost and start using it to speed up your computer.  It will automatically use ReadyBoost whenever the card is connected to the computer. When you view your SD card or flash drive in Explorer, you will notice a ReadyBoost file the size you chose before.  This will be deleted when you eject your card or flash drive. If you need to remove your drive to use elsewhere, simply eject as normal. Windows will inform you that the drive is currently being used.  Make sure you have closed any programs or files you had open from the drive, and then press Continue to stop ReadyBoost and eject your drive. If you remove the drive without ejecting it, the ReadyBoost file may still remain on the drive.  You can delete this to save space on the drive, and the cache will be recreated when you use ReadyBoost next time. Conclusion Although ReadyBoost may not make your netbook feel like a Core i7 laptop with 6GB of RAM, it will still help performance and make multitasking even easier.  Also, if you have, say, a memory stick and a flash drive, you can use both of them with ReadyBoost for the maximum benefit.  We have even noticed better battery life when multitasking with ReadyBoost, as it lets you use your hard drive less.  SD cards and thumb drives are relatively cheap today, and many of us have several already, so this is a great way to improve netbook performance cheaply. Similar Articles Productive Geek Tips Speed up Your Windows Vista Computer with ReadyBoostSet the Speed Dial as the Opera Startup PageAsk the Readers: What are Your Computer’s Hardware Specs?Understanding Windows Vista Aero Glass RequirementsReplace Google Chrome’s New Tab Page with Speed Dial TouchFreeze Alternative in AutoHotkey The Icy Undertow Desktop Windows Home Server – Backup to LAN The Clear & Clean Desktop Use This Bookmarklet to Easily Get Albums Use AutoHotkey to Assign a Hotkey to a Specific Window Latest Software Reviews Tinyhacker Random Tips DVDFab 6 Revo Uninstaller Pro Registry Mechanic 9 for Windows PC Tools Internet Security Suite 2010 Recycle ! Find That Elusive Icon with FindIcons Looking for Good Windows Media Player 12 Plug-ins? Find Out the Celebrity You Resemble With FaceDouble Whoa ! Use Printflush to Solve Printing Problems

    Read the article

  • Is complete boost going to be included in C++0x?

    - by iammilind
    Many utilities of boost have been included as part of extended C++ TR1 currently. Is the complete boost library going to be included once the standard is officially out ? In other words, do I need boost library, if I have complete standard conforming C++11 compiler ? If not then any reason for that (Reliability cannot be an issue; as far as I know it's written by many people from standard committee) ?

    Read the article

  • 5 ways the Exceptional DBA Award could boost your career

    - by Rebecca Amos
    Winning the Exceptional DBA Award won’t just get you full conference registration for the PASS Summit – it could also change your life and career. With a little help from our past winners, here are the top 5 ways the Exceptional DBA Award could take your career to the next level: 1. Recognition from your peers As 2009 winner Josef Richberg says, “Being recognized by your peers is the highest honor one can receive.” Whether you enter yourself, or are nominated by a friend or colleague, the fact that the winner is selected by the SQL Server community is a great chance for your peers to recognize your achievements as a DBA. 2. Boost your CV Winning the Exceptional DBA Award not only shows that you excel as a DBA, but that SQL Server experts think so too – a huge vote of confidence for any prospective employer. 2008 winner Dan McClain agrees, “It brings another level of 'wow' to my resume”. 3. Networking opportunities within the community Whether you want to increase your experience as a writer, speaker or blogger, winning the Exceptional DBA Award can open up new opportunities within the SQL Server community. Plus you’ll make new friends along the way, as Josef has discovered: “It is an unbelievable community that has become an extended family.” 4. Award ceremony at the world's largest technical SQL Server conference The Exceptional DBA Award is presented at the PASS Summit, giving you great networking opportunities and a chance to be seen by people throughout the SQL Server community. 5. Increased personal confidence Finally, the Exceptional DBA Award should give a huge boost to your personal confidence. Last year’s winner, Tracy Hamlin has certainly found this: “The recognition has given me new confidence and the drive to accomplish even loftier goals.” Read the full interview with our past winners to find out how why they’re encouraging you to enter this year’s Exceptional DBA Awards. Already inspired? Then why not get started on your entry straightaway: www.exceptionaldba.com

    Read the article

  • How to implement generic callbacks in C++

    - by Kylotan
    Forgive my ignorance in asking this basic question but I've become so used to using Python where this sort of thing is trivial that I've completely forgotten how I would attempt this in C++. I want to be able to pass a callback to a function that performs a slow process in the background, and have it called later when the process is complete. This callback could be a free function, a static function, or a member function. I'd also like to be able to inject some arbitrary arguments in there for context. (ie. Implementing a very poor man's coroutine, in a way.) On top of that, this function will always take a std::string, which is the output of the process. I don't mind if the position of this argument in the final callback parameter list is fixed. I get the feeling that the answer will involve boost::bind and boost::function but I can't work out the precise invocations that would be necessary in order to create arbitrary callables (while currying them to just take a single string), store them in the background process, and invoke the callable correctly with the string parameter.

    Read the article

  • Containers of reference_wrappers (comparison operators required?)

    - by kloffy
    If you use stl containers together with reference_wrappers of POD types, the following code works just fine: int i = 3; std::vector< boost::reference_wrapper<int> > is; is.push_back(boost::ref(i)); std::cout << (std::find(is.begin(),is.end(),i)!=is.end()) << std::endl; However, if you use non-POD types such as (contrived example): struct Integer { int value; bool operator==(const Integer& rhs) const { return value==rhs.value; } bool operator!=(const Integer& rhs) const { return !(*this == rhs); } }; It doesn't suffice to declare those comparison operators, instead you have to declare: bool operator==(const boost::reference_wrapper<Integer>& lhs, const Integer& rhs) { return boost::unwrap_ref(lhs)==rhs; } And possibly also: bool operator==(const Integer& lhs, const boost::reference_wrapper<Integer>& rhs) { return lhs==boost::unwrap_ref(rhs); } In order to get the equivalent code to work: Integer j = { 0 }; std::vector< boost::reference_wrapper<Integer> > js; js.push_back(boost::ref(j)); std::cout << (std::find(js.begin(),js.end(),j)!=js.end()) << std::endl; Now, I'm wondering if this is really the way it's meant to be done, since it seems impractical. It just seems there should be a simpler solution, e.g. templates: template<class T> bool operator==(const boost::reference_wrapper<T>& lhs, const T& rhs) { return boost::unwrap_ref(lhs)==rhs; } template<class T> bool operator==(const T& lhs, const boost::reference_wrapper<T>& rhs) { return lhs==boost::unwrap_ref(rhs); } There's probably a good reason why reference_wrapper behaves the way it does (possibly to accomodate non-POD types without comparison operators?). Maybe there already is an elegant solution and I just haven't found it.

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >