Click here to Skip to main content
15,889,578 members
Everything / Boost

Boost

Boost

Great Reads

by Martin Vorbrodt
Parsing Command Line Options
by Martin Vorbrodt
Plugins: loading code at runtime
by Dave Ceddia
Frameworks like Vue have the notion of “computed properties” – a way to derive some new, possibly complex data based on something passed in. This post covers how to achieve the same result in React.
by Martin Vorbrodt
How to print stack traces

Latest Articles

by Daniel Ramnath
Reverse proxy developed using BOOST 1.75 asynchronous ASIO calls
by Dominik Reichl
KeePass is a free, open source, light-weight and easy-to-use password manager.
by H_
C++ list comprehension
by DotnetShtien
In this article we will dicuss when new feature added recently to the meta-programming library which is the command contracts.

All Articles

Sort by Title

Boost 

5 Dec 2012 by Im2N00By
Hello,At the moment I have a little design issue. I created proxy server for my application, but I'm having trouble to delete sessions. (using boost::asio)I obviously have two sockets. One connected from proxy to client and one connected from proxy to server. I use async operations to...
14 Feb 2014 by Sergey Alexandrovich Kryukov
Sorry, this is not a question. And this is not the sample-finding service, sorry. Do the Web search. In case of some doubt, please ask a specific question.—SA
6 Jul 2015 by phillipvoyle
A sample implementation of a minimal http web server using boost::asio in C++
14 Jul 2011 by ocoudert
The best way to understand how to serialize with boost is to walk through increasingly complex serialization scenarios.
14 Jun 2011 by T2102
I wrote multi-threaded Excel C API code in Excel 2003 (before official multi-threading support) that puts a thread to sleep while it waits for jobs to be added whenever the thread is not busy. However, I seem to get a memory error when I put the thread to sleep with the following...
14 Jun 2011 by Albert Holguin
WaitForSingleO...
13 Sep 2013 by geoyar
Applying Ant Colony Optimization algorithms to solve the Traveling Salesman Problem.
7 Jul 2016 by Zebedee Mason
Software for automatically constructing architecture diagrams and metrics from source code and .NET assemblies is presented. Examples for Visual C++, Python, the Linux kernel, Boost and .NET are discussed.
1 Nov 2013 by Gabi Barcan
Call methods of an existing class in MFC asynchronously, while still preserving the thread affinity required by MFC and COM.
3 Apr 2012 by WebBiscuit
Base64 Encoder and Boost
15 Mar 2019 by Martin Vorbrodt
Blocking queue
14 Mar 2014 by Mr.HA-AS
Hello,I am trying to use Boost Conditional variable in my application to synchronize two different threads as following:The main thread, will create a TCP server and instance of object called MIH-User and register a callback to an event_handler.Main.cpp/*** Default MIH event...
25 Oct 2011 by hariharansa
Hi all, I am learning boost library for the network programming and i read about boost bind and have some doubts in the following code.boost::asio::async_read_until(socket_, buf, boost::regex("\r\n\r\n"), boost::bind(&connection::handle_read, shared_from_this(), ...
26 Oct 2011 by Richard MacCutchan
Because that is the way the designer wrote the function; note that boost::bind() actually takes four parameters in both cases. You need to check the documentation to see the significance of each parameter in a function.
26 Oct 2011 by hariharansa
Hi , i am learing boost for a couple of days and when i tired their "Daytime.3 - An asynchronous TCP daytime server" example from the link http://think-async.com/Asio/boost_asio_1_3_1/doc/html/boost_asio/tutorial/tutdaytime3/src.html[^]it shows the following erro while building :"...
4 Nov 2011 by Paul M Watt
According to the Revision History[^], 7th item from the bottom (for the current version 1.47.1).The io_service() member function was removed.You will just need to change the name of the function in the source to the new function: get_io_service().Regards,
20 Jun 2021 by viki_10
i have using boost 1.76.0 version . I tried compiling in visual studio 2013. What I have tried: #include #include "boost/process.hpp" int main(int argc, char* argv[]) { boost::process::child *child; } i...
31 Oct 2013 by DigitalInBlue
This seems like it should be trivial, but I'm having problems getting started with Boost Python. I want to make a little demo to work out some issues. The main problem is that I need to have a class with a member function return a shared_ptr to a base type. That base type will almost always...
24 Mar 2011 by ganesh_IT
Hi guys, i am new to boost libraries regular expression.for me its something complicated.I need to separate word form my format.The format is Dear customer {Customer.Customer_Id:D} offer {Offer.Offer_Id:D} From....i need to separate all words and {Customer.Customer_Id:D} as a separate...
24 Mar 2011 by Prerak Patel
It is not much clear, but seems like you want to separate {Customer.Customer_Id:D}, {Offer.Offer_Id:D} from your format string.If so, following expression will help you get there.{[^\s]+}If you don't want {} then capture groups{([^\s]+)}
21 Dec 2010 by jean Davy
#include must not be in precompiled header
3 Jun 2011 by Farier
I have an application that is relying heavily on boost signals2. One issue that I want to address is that I do not want objects to be able to register a member function to a signal twice. Is there a mechanism to enforce that? Looking at the tutorial, I don't really see this kind of...
11 Mar 2015 by Member 11500796
struct add_1000 { add_1000(unsigned& r_) : r(r_) {} void operator()(wchar_t) const { r += 1000; } unsigned& r; }; struct add_roman { add_roman(unsigned& r_) : r(r_) {} void operator()(unsigned n) const { r += n; } unsigned&...
10 Aug 2017 by Piraisudan
When I include header, it will shows syntax error : identifier 'heap_memory' in file thread_heap_alloc.hpp. How to solve this error? What I have tried: I installed boost. And tried differently but i can't solve that error.
10 Aug 2017 by CPallini
Did you try Google? See, for instance, c++ - boost::thread compilation error in Visual Studio 2010 - Stack Overflow[^].
14 Mar 2014 by Mr.HA-AS
I am trying to implement a state machine as a part of a class called" Source Transaction". Evey-time I receive a request in the main thread, it generates an instance of this class and the state machine starts executing until it reaches a state where it has to wait for a response in the main...
15 Oct 2012 by Ryan Zahra
Hi all, I have a piece of code that will try to extract URLs (through the use of regexs) from a piece of text. My code works fine when the text is small, however, when having a very large text, the boost::regex_search function takes almost 1 minute to complete. This is way too much...
15 Oct 2012 by CPallini
I think blocking the function is not an option (or at least a good option). You should find the flaw in your expression (regular expressions do have pitfalls, see, for instance "Runaway Regular Expressions: Catastrophic Backtracking"[^]).
5 Jun 2013 by varunpandeyengg
Hey guys, I am new to boost. I have to work with boost::serialization. My class is having a member that is wstring. This wstring may have unicode values like ഡഢണതഥദധന [this is just some garbage I tried to test it with...]When I try to add the unicode member to the xml_oarchive, it...
5 Jun 2013 by Richard MacCutchan
Please do not repost the same question[^] in multiple forums.
1 Jul 2013 by MaxLovic
HiGot Visual Studio 2013 preview. Finally managed to build my projects targeting XP. But can't build boost. Tried 'toolset=msvc-13.0', but didn't work.Is it possible to build boost 1.53.0 with msvc-13.0 or need to wait until the new release?Thanks.
2 Jul 2013 by Droperidolum
Hi!I found this patch (link) but didn't tried yet.
14 Nov 2018 by Vlad Neculai Vizitiu
Hello and welcome to part two of the use and abuse of the C# modifier keywords, Last time we looked at the access modifiers that apply to types (class, struct, and enums) and members (fields, methods, nested classes, etc.
4 Apr 2015 by BrainlessLabs.com
In this tip series, we will create a small C++ game engine.
8 Aug 2019 by Audiory Researcho
How can I create a minimal Visual Studio Code 2.2 workspace with: 1. C++ library project (if possible *.so - shared library, if not *.a to use with C#) 2. (If required) something instead of C++/CLI wrapper project(it is linux os no MS C++/CLI) may be wrapper on C# side? 3. C# Application...
8 Aug 2019 by Richard MacCutchan
See Platform Invoke (P/Invoke) | Microsoft Docs[^]
17 Dec 2019 by H_
C++ list comprehension
13 Jan 2022 by Optimistic76
I am trying to expose a c++ class to python using boost, and extract a object defined in python in c++ side. What I have tried: I defined my c++ class in the file MyInt.h: struct MyInt { int i_; }; If I define the...
13 Jan 2022 by KarstenK
The error messages sound like that the struct isnt marshallable and you need to reconfige the interface. My experience from C# to C++ and vice versa is that native interfaces are the best. You better read Calling C or C++ From Python tutorial to...
26 Jun 2016 by bishopnator29a
Saving, Loading and data migration in compact library
3 Nov 2022 by Daniel Ramnath
Reverse proxy developed using BOOST 1.75 asynchronous ASIO calls
2 May 2014 by Mr.HA-AS
Hello,I am trying to compile my program using b2 tool, I defined a Jamroot file as following to assist in the compilation. When I execute the command 'b2 toolset=gcc', I get multiple error stating that b2 can't find Boost header files like asio.hpp and bind.hpp:So what am I missing in...
18 Jan 2021 by viki_10
Hi, when i using boost child to create a Spawn Child.parent and child process are created.If terminate a parent process(Ctrl + c ) it terminated, but child process is not Killed. child is alive only.how to kill child process if parent...
18 Jan 2021 by k5054
As Richard pointed out, you can trap Ctrl-C and then pass a signal to the child to exit gracefully. If you are on linux, and you have the source code to the child process, you can set the Parent Death Signal using prctl(PR_SET_PDEATH_SIG,...
9 Mar 2016 by Member 10305620
I have a problem while closing the client app, when server is closed.I have my read thread and a class which implements tcp connection.Code is below:This is in my main file - main.cppvoid thread_handling(){ /* * Start threading only if server is connected, if not connected Exit...
25 Nov 2016 by BadJerry
In SQL, you can compare successfully two strings depending on the collationWith Latin1_General_CI_AS, fussballmanager and fußballmanager are considered equal. They are different with SQL_Latin1_General_CP1_CI_AS.I am trying to replicate the same behaviour in C++. I understand it's...
25 Nov 2016 by Jochen Arndt
There is a really good answer about string comparison at this SO thread:c++ - How to compare a "basic_string" using an arbitary locale - Stack Overflow[^].Regarding your SQL examples, both should return false for the example strings when using AS (Accent Sensitive). But I'm not quite sure...
14 Aug 2018 by Dave Ceddia
Frameworks like Vue have the notion of “computed properties” – a way to derive some new, possibly complex data based on something passed in. This post covers how to achieve the same result in React.
5 Jul 2015 by stevenong_2006
This project is intended for one to create an automated build environment to build the Boost libraries set to be used with VC++ in Visual Studio 2013.
23 Nov 2013 by Renato Tegon Forti
This article present a Boost.Application, Boost.Asio, and Boost.Thread library used to build a Work Queue application.
16 Mar 2014 by Mr.HA-AS
Hello,I am thinking about a hierachy for my application, and I need some advice regarding it. I want to build a library using c++ which will serve as an abstraction layer between applications and low-level process. The library will provide some APIs for the applications for some...
17 Mar 2014 by pasztorpisti
In my opinion you should write a server and both the event consumers and event producers should be clients. Basically your library would be just a client that sends/receives messages from the server. This has many-many benefits:- Your processes can be on different machines.- Socket...
1 Apr 2013 by cocaf
The pause/resume thread functionality helps to avoid problems caused by invalid memory access and race conditions.
14 Aug 2019 by essentialSQL
Database indexes explained
6 Feb 2019 by IAmJoshChang
How to add the Invincible Power-Up Into The Game
18 Mar 2014 by samanehmazidi
I want to know that how alexabooster works. Actually I'd like to implement it using C# and want to know which classes could be used.I've studied about HttpWebRequest and HttpWebResponse. but I didn't find whether they have a property to set IP address or not.Do these classes really hit the...
18 Mar 2014 by Dave Kreskowiak
If you are naïve enough to ask the question "which class should I use", you don't have the know-how to write such an application.There isn't any "one class" you should use, but lots and lots of them.No, we're not going to walk you through re-writing someone else's crap-ware.
24 Feb 2011 by Andriy Padalka
Module to dynamically assign, store, and call with handlers different functional objects: functors, functions, member functions.
27 Jan 2018 by saide_a
I am new in using boost serialization library. I want to save and load data to and from STL structures using text_iarchive and text_oarchive. I used bellow code for that: mystruct test; test.initial(); { std::ofstream ofs("filename.dat"); boost::archive::text_oarchive ar(ofs); ar &...
29 Jan 2018 by saide_a
yesterday I found out something first when I use cout for printing my structure it works Okey. but when I want to read and write from file this happens, this problem occurs only with use of stack and queue. At second, I used headers for serialization in main function before, but when I use that...
19 Mar 2013 by Igor Stanic
Extending boost::filesystem for Windows and Linux.
19 Mar 2013 by Igor Stanic
Manage Linux Trash and Windows Recycle Bin with C++.
3 Feb 2013 by Falconapollo
Boost is an excellent library, but sometimes, it's inconvenient to add the whole library. So I want to extract a little part of Boost, only the necessary files are extracted.I know BCP.exe, but it didn't work as expected. BCP.exe extract too many unnecessary files.I work with Visual C++...
3 Feb 2013 by Richard MacCutchan
It is impossible to suggest what you can remove as all components tend to be interconnected. Libraries such as boost are developed over time and components are added and updated. Removing any single file could mean that your program will not build. And since disk space is not at a premium these...
3 Feb 2013 by Matthew Faithfull
I know where you're coming from because I've faced the same issue with Boost library code myself. I want to use cool idea X but I don't want to be responsible for adding 2000 dependencies to the source tree and updating them every few weeks let alone fixing anything that breaks as a result of...
24 Jun 2015 by cxxxxf
Hi, There are link errors when I compile a simple demo.In function `boost::archive::text_oarchive::text_oarchive(std::basic_ostream >&, unsigned int)':demo.cpp:(.text._ZN5boost7archive13text_oarchiveC2ERSoj[_ZN5boost7archive13text_oarchiveC5ERSoj]+0x25):...
22 May 2011 by PeteBarber
I've been learning about BOOST Spirit; a C++ expression based compiler generator. One of the examples is for a Roman Numeral parser. This contained the following interesting code for pre-loading a symbol table...
14 Apr 2018 by George Shagov
Four Boolean Logic induction
14 Jan 2011 by jean Davy
Read/write serialize/unserialize any kind of arbitrary set of C++ data structures in the Registry.
30 Apr 2016 by grayrain
Regular Expression: (?
30 Apr 2016 by leon de boer
Sergey was close (?
16 Apr 2014 by Member 10271708
ini file may be not in usual, just like: [ip]ip1ip2ip3[domain]do1do2... in windows, there is 'GetPrivateProfileSection', But I want to do it by boost. I know there is a 'boost::property_tree::ini_parser', but read_ini() can not work for the ini format above.Is there...
15 Apr 2014 by CPallini
As suggested, you can easily write your own code for parsing such a simple format (and rewriting it as XML is a good suggestion too). Even Boost.Regex is, in my opinion, overkill for such a format.
19 Oct 2021 by Weird Japanese Shows
Hello guys. I know, the header is not clear enough. Let me explain the situation in detail. I've a server which takes messages from clients, then check if the message type matches any of the existing types via if - else if(there are more than...
19 Oct 2021 by k5054
At a guess: the strings "test1", "test2", "test3" are all very short and maybe the compiler is smart enough to use a "small string optimization", and ends up comparing 64bit ints rather than doing a string compare. You also have a very small...
15 Aug 2014 by Member 11014998
i downloaded boost library 1.55 and i bootstrap and i linked that to visual studio 2012 by including library path and additional include directory. while i compile my project i have an error as ' cannot open libboost_serialization-vc110-mt-gd-1_54.lib'. i dont know where i have gone wrong?.
15 Aug 2014 by Sergey Alexandrovich Kryukov
It sounds like you though that the library is the header files. Probably you configured the path to them, so the compiler is happy with you.But no, the main library content is object and library file, not header files. You need to reference all files you want to line to the linker, all you...
1 Feb 2015 by Paul Heil
A quick demonstration of how boost.phoenix makes a messy boost.bind call much easier to read
27 Dec 2023 by Member 15872449
I am using centos 5.11 with gcc-4.6.3 support ,I need to build boost thread library(version 1.82) using the same gcc without upgrading . What I have tried: The commands I used are ./bootstrap.sh ./b2 But running the bootstrap command I am...
27 Dec 2023 by Richard MacCutchan
See B2 User Manual - 1.84.0[^].
21 May 2013 by Dusan Paulovic
Hello, I am trying to find a way to compare unicode strings without accents and case, so for example strings 'áíé' and 'AIE' should be considered equal.I have tried boost::locale, also unicode normalisation, but can not get it working correctly.I think that ICU would work, but my boss does...
21 May 2013 by Jochen Arndt
You can try to use WideCharToMultiByte() to convert the strings to ASCII using precomposed characters and compare the converted ASCII strings:char lpszAscii[128];::WideCharToMultiByte(20127, WC_COMPOSITECHECK, L"Dušan áíéúó", -1, lpszAscii, 128, NULL, NULL);int nCompare =...
13 Feb 2020 by Optimistic76
I'm trying to copile an example of how to create a module callable from python3.7. I think i have done all the steps correctly but when compiling the project i'm getting a lot of unresolved symbol errors (lnk2019). The sources are very simple: ...
28 Jun 2021 by dilsdgr8
My websocket server URL is localhost/webstream/wsocket Iam trying to create a C++ websocket client that connects to this server using boost. tcp::resolver resolver{ioc}; _pws = new websocket::stream(ioc); ...
10 May 2019 by Member 13663267
Hi all, i am stuck in one euqation in cpp code, please help me to solve it,, I am using, Qt 4.8.7 Compiler MinGW32 (checked with boost library boost 1.70) I want to use below equation in one of the code A = g^a mod p; //g raise to a modulus p. (something like 2^5 % 3) = 32%3 = 2 (This...
10 May 2019 by Stefan_Lang
First of all, you can significantly speed up the calculation of a power expression with a high integer exponent, by repeatedly squaring intermediate results, rather than just multiplying with the base. Here's a sample implementation that you can adapt to your prefered integer type: #include...
6 May 2014 by AndyUk06
A non-nonsense guide to setting up Boost threads in Visual Studio environments.
16 Mar 2014 by Sergey Alexandrovich Kryukov
The question makes no sense: the threads are always executed outside the function which created them. More exactly, threads and functions are orthogonal: any function can be executed be several thread, each thread can call several functions (as in single-threaded programming). The structure of...
16 Mar 2014 by Mr.HA-AS
Hello,I have an event handler in the main thread, which receive events from outside process. And upon the receipt of a new event, a new thread is created to handle the event. The problem is whenever I create a new thread inside the event handler, it will be destroyed when the event handler...
17 Aug 2013 by Renato Tegon Forti
Hi All,Anyone can help-me!I want know if have some way to limit speed of tcp socket on asio?For sample if my app open a socket and start to send a file to my server! How to limit upload speed?If I want limit to 100kb/s, have any way? Anyone have any idea: how I can achieves...
18 Aug 2013 by H.Brydon
You can determine the packet size, and implement a timer so that you don't send any more than 'x' bytes per second by counting manually in your program and watching the timer. If the data you are sending is reasonably large, you can estimate the packet size as roughly the number of payload...
29 Oct 2021 by Weird Japanese Shows
Hello, I'm using counting sort for sorting elo rating of players, I've compared many different sorting techniques and decided to use counting sort. Even if counting sort is a little slower than insertion sort, because it's more stable and...
28 Oct 2021 by Greg Utas
You could try creating locals for r.size() and count[r[i]->elo - min], but it probably won't matter if you're using a decent optimizing compiler. There's probably some overhead caused by boost::shared_ptr. A unique_ptr would be slightly faster,...
28 Oct 2021 by Rick York
Regarding your comments - they do not explain why you need to use shared_ptr. If you control the lifetime of the objects then you can safely use unique_ptr. I always make sure that I do (control object lifetimes) so I never, ever use shared_ptr...
29 Oct 2021 by Patrice T
Quote: How to optimize this code for speed any further Assuming the Elo ranking is positive values only: - At cost of count a little larger, min can be just removed from code. Assuming you know the range of values of Elo: - you can set max to a...
11 Nov 2015 by Member 12133830
I saw this guide for configuring boost on VS 2010: How to use Boost in Visual Studio 2010.[^]I did exactly what was wrriten (on 64 bit), but changed in (4) to toolset=msvc-14.0 than I tried building this program from boost getting started web: #include "stdafx.h" #include...
12 Nov 2015 by Jochen Arndt
It seems that you forgot to add the library file to your project. The file name should be libboost-regex*.lib (* = VC version, single/multi thread, release/debug). Look it up in your boost library directory and add it to your project at Linker - Input - Additional Dependencies (the debug...
22 Dec 2016 by Member 12903437
While logging using BOOST in task manager the size of memory keeps on increasing it does not delete it. For example if I print 6000 * 24 times the size of .exe(memory) in task manager is increased till the time its logged. Is there any way to free up the memory for boost. using BOOST_LOG_SEV for...
22 Dec 2016 by KarstenK
Detecting memory leaks isnt easy, so you need some tools if you really want to do it. I would try at first to contact some people with deep boost knowledege.Sometimes the task manager is fooling at the first look. Read here how to find memory leaks. And if you want to dig deeper you may find...
16 Feb 2012 by Fernando A. Gomez F.
Hi everybody,I'm reading the documentation regarding boost's filter_iterator[^] and I'm trying to use it as follows. I have two classes: employee and catalog. The latter is a container for the former. The container, internaly, uses a std::list to store the data and thus I have full...