Click here to Skip to main content
15,880,796 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 Score

Boost 

25 Oct 2011 by Sergey Alexandrovich Kryukov
The underscore? It does not do anything, this is just a valid part of the variable/type/field/function name.If you mean io_service_, acceptor_ and new_connection_ before the body of the constructor server::server and after ':' — they are field initializers, as well as thp. They are...
14 Jun 2011 by Albert Holguin
WaitForSingleO...
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...
21 Mar 2019 by Martin Vorbrodt
Parsing Command Line Options
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...
10 Mar 2011 by Ryan Zahra
http://www.boost.org/doc/libs/1_46_0/doc/html/bbv2/installation.html
16 Feb 2012 by Ashish Tyagi 40
You need to create a functor, likestruct Range{ Range(int min, int max): _min(min), _max(max){} bool operator(int value_) { return (_min
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...
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...
19 Mar 2019 by Martin Vorbrodt
Plugins: loading code at runtime
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...
7 Feb 2013 by Matthew Faithfull
I wouldn't worry about TCP, that can take care of larger streams than 4GB. It does so every time I download a new Linux Distro these days, let alone when I'm playing with a few hundred hours of video footage.Asio is another question but I seriously doubt if you'll break it with anything like...
10 Sep 2013 by Espen Harlinn
Use a barrier[^] - the 'trick' is that all the threads, including the thread that is supposed to do something when the other threads have finished, have to 'pass' the barrier.Best regardsEspen Harlinn
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.
15 Oct 2015 by Jochen Arndt
You must add the path to the boost libraries at Library Directories in the Directories Properties Page[^].
12 Mar 2016 by Serkan Onat
when you use raw sockets to implement a protocolfor HTTP you need to follow the steps belowNote : i will use code parts from the sample link you have provided (without testing myself)first find target end point ,you need an IP address and port (default 80 for HTTP) can also be 8080...
19 Dec 2017 by Jochen Arndt
It has been merged into the C++17 standard: std::filesystem::directory_iterator - cppreference.com[^]. If you still want to use the Boost implementation (and not compiling with C++17 support) you must use an older Boost version or check if it is still there but requires a definition to be enabled.
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.
16 Mar 2019 by Martin Vorbrodt
How to print stack traces
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...
9 Sep 2019 by DotnetShtien
In this article we will dicuss when new feature added recently to the meta-programming library which is the command contracts.
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,...
17 Aug 2021 by Greg Utas
That's a very generic error that doesn't say why abort was called. But press Retry and use the debugger to find the problem. If you don't know how to use a debugger, Visual Studio has lots of documentation about it. Using a debugger is...
11 May 2022 by k5054
Quote: Could this be related to the compiler version? That's quite probable. You might be able to solve it by trying different standard compliance versions. GCC 4.8 compiles by default as C++ 98, you could try setting -std=c++11 for the compile...
7 Jul 2023 by CPallini
Possibly some insight here: #59384 (boost uses zstd if present) – MacPorts[^].
7 Jul 2023 by Rick York
This, "error LNK2019: unresolved external symbol", means the linker can't find a module it needs to build the program. This is usually caused by the module not being built or it was built and can't be found in the directories the linker is...
27 Dec 2023 by Richard MacCutchan
See B2 User Manual - 1.84.0[^].
9 Nov 2010 by ed welch
Does anyone know of a working visual studio vizualizer for boost unordered_map (that's the thing that goes in autoexp.dat)?
9 Mar 2011 by Reza Oruji
hii am trying to install boost library in ubuntu,but when i Issue the "./bootstrap.sh commands in the shell and then go to "/usr/local/lib" i don't see any library therewhat is wrong in my commands?
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...
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...
10 Oct 2011 by WodgerDodger
I need to create a template (non-member) function with two implementations for a multi-threaded delegate connection system.The chosen implementation needs to be determined by the cv qualifier of the last template parameter which expects a (non-type) member function pointer type.This sounds...
9 Oct 2011 by mbue
Your source pointer type must depend on the target pointer type because the pRetargetingFunction depends on the target pointer type. An explicit cast is not useful for template...
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 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 :"...
13 Nov 2011 by Alex Culea
Hi!Has anyone managed to build Boost with ICU support without requiring any DLLs from ICU bin directory (I'm using VS2010)?Regards
3 Dec 2011 by shankha2010
Hi I am new user of Boost I wanted to connect to a http web site by proxyand want to download "www.boost.org/LICENSE_1_0.txt" this file. it is telling connectedbut not able to download the link above and also not able to maintain the connection. here is my code. try{ io_service...
4 Feb 2012 by Reza Oruji
hii installed the boost library from Debian synaptic package manager few days ago, now i have downloaded the boost library from boost.org and i want to install it ,do i have to remove the older version from package manager first or not?
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...
18 Feb 2012 by Fernando A. Gomez F.
Hi Ashish,Your solution worked perfectly, with a slight modification. Thank you very much, it really helped a lot. For the record, I'll leave my working program. Now I'll try to make it word with std::function and using lambdas... :-)#include #include #include #include...
30 Mar 2012 by bieren83
I'm trying to implement a simple segregated storage using Boost but having problems using the classes. Here is a test application. It crashes at the two last lines where I try to allocate partitions from the memory pool.Does anyone see a problem here?#include...
3 Apr 2012 by WebBiscuit
Base64 Encoder and Boost
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"[^]).
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...
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...
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 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...
7 Feb 2013 by WaZoX
Hi,I have a question about tcp data streams in c++. I understand that since a 32-bit integer is used to count the number of bytes sent in the stream there must be a limit of sending 2^32 bytes (4 GB) per stream, or am I wrong?Is this a problem one must consider when using e.g. boost::asio...
7 Feb 2013 by H.Brydon
On a 32 bit system, an int is 32 bits and any 'size' value will be determined by this as an upper limit (actually an unsigned int, not a signed int) but you will run into other limits far sooner than that. The 32 bit int (unsigned) also defines address space, and you don't have all of that...
24 Feb 2013 by themrpacu
Hello,I'm trying to compile an old example of using the boost::spirit library to parse an ini file using Code Blocks. Here it is:INI file reader using the spirit library[^]I have chosen to use the 1.3.1 spirit version. In the main.cpp file I have: #include...
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 =...
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.
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...
10 Sep 2013 by Dilan Shaminda
Hi,I am new to boost threads and i have a char type for loop.Inside my for loop i am calling a function which does different operations based on the input char....below is my codechar * letters = "ABCDEFGHIJKLMNOPQRSTUVWXZ"; for (char * ptr = letters; *ptr != 0; ++ptr) { char ch...
10 Sep 2013 by User 59241
Read the section on boost threads in this document:http://www10.informatik.uni-erlangen.de/Teaching/Courses/SS2011/CPP/czilli.pdf[^]An example here:http://stackoverflow.com/questions/11407577/how-to-use-boost-barrier[^]
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...
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
27 Feb 2014 by Mr.HA-AS
I am trying to compile The example of Boost Blocking TCP ECHO Client[^] using g++ compiler:g++ -o test Simulator_main.cpp -I /home/ha/MIH/boost_1_49_0/ -L /usr/local/lib/ -lboost_system -lpthreadThe compilation is success, but when I run the program I get the following...
27 Feb 2014 by Garth J Lancaster
On windows you would either put libboost_system.so.1.49.0 in the same 'folder' as the compiled (exe) (not a good idea with big distro's like boost), or, make sure the directory where all the boost 'binary'/compiled libs/dlls is/are is on your pathIm not sure how Linux searches for...
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...
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...
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.
21 Mar 2014 by manishakc
Hi All,I'm trying to serialize shared pointer using boost but it gives error :Error 1 error C4308: negative integral constant converted to unsigned type c:\users\mydirect\future\lib\boost_1_55_0\boost\mpl\print.hpp 51 1 InputSpent more than 2 days on this but no clue.. when i comment...
22 Mar 2014 by The_Inventor
I think the cleaned version below will be more workable. The error code refers to Print.hpp line 51 first input.// MyData.hpp filetypedef struct tagMyData{ std::string id; std::string name; boost::shared_ptr ptMydata;public: MyData(void); MyData(const...
31 Mar 2014 by Mr.HA-AS
Hello,I have multiple writers in a form of separate processes which will get a signal at the same time to start writing on a managed shared memory segment, each writer will create its own unique managed object. On the other hand I have one reader only as a separate process. Which can access...
31 Mar 2014 by barneyman
The first item in this list[^] appears to what you're after
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...
8 Jun 2014 by Mr.HA-AS
I want to share a dynamic array of characters between two processes using Boost Shared Memory. I use the following two pieces of code to do that:Producer Process:char *data;unsigned int share_length;unsigned int offset;std::string data_to_share(data + offset, data + offset +...
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...
14 Oct 2014 by Member 11153987
Following is simple boost serialization code, but ClassA.name member can't be serialized and deserialized, anyone can help me? class ClassA{public: int number; char name[64];};templatevoid serialize(Archive & ar, ClassA& g, const unsigned int...
16 Nov 2017 by ChrisB91
Hi,I'm trying to send large files (~4GB) from a http server to some clients. My server implementation is based on Boosts HTTPServer3 Example HTTPServer3.The problem is, that the files are first completely loaded into memory and then send to the Client.I would like to read chunks of about...
10 Dec 2014 by C-A-P
I have two classes SslHandshake and SslRequest with according to names functionality.After client and server handshakes are done in the SslHandshake, I pass both sockets to SslRequest and start transferring data from server to client.1. If I is not waiting for finishing of transferring,...
10 Dec 2014 by Aescleal
For resources that should be shared between other objects and automatically deleted when the last object using that resource is destroyed you use a shared_ptr. If you're using a C++98 compiler then use the implementation from boost or tr1, otherwise use the standard one.You could simplify a...
24 Dec 2014 by johnbMA
Hi:I'm currently working on a Microsoft (unmanaged) C++ project which utilitizes Boost C++ libraries. It's been quite a while since I've done C++ and I have noprevious experience using the Boost libraries.We are using Boost 1.55 and MSVC 2013. We used CMake to generate the Visual...
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&...
2 Jun 2015 by yufengzjj
#include #include class A{public: A(){} ~A(){} template void call_handler(_Handler handler) { handler(); }};class B{public: template void call_handler(_Handler...
15 Oct 2015 by Member 12062486
when I use VS2015 complie a program,it shows > LINK : fatal error LNK1104: can`t open file“libboost_filesystem-vc140-mt-1_58.lib”.( Windows 7 64 bit)Following is the commend I use to complie Boost:b2.exe install --stagedir="c:\temp" address-model=64 --build-type=complete stage
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...
12 Mar 2016 by Member 10305620
I am facing a strange issue while trying to resolve endpoints using boost resolver in c++.Case:I am trying to connect to a website http://localhostIpAddress/test/ using boost.where local address of server is "172.34.22.11"(say). I am facing the error saying "**resolve: No such host...
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...
30 Apr 2016 by leon de boer
Sergey was close (?
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...
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...
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[^].
16 Nov 2017 by Member 13515450
Hi!!! I was going to send a struct from a client to a server using boost::asio::async_write_some, in this case boost::serialization and boost::property_tree come to help, //boost::serialization struct blank { int m_id; std::string m_message; template void...
16 Nov 2017 by KarstenK
Take a look at this answer at stackoverflow. Consider splitting the data into smaller chunks in network packet size multiples to minize sending half empty packets. Multiples of 1024 may fit best.
16 Nov 2017 by KarstenK
Your question is already answered on Stackoverflow.
19 Dec 2017 by PrafullaVedante
I am in process of migrating my project code to the newer version of boost (1.62 from 1.38). What i am experiencing is a general purpose class "wdirectory_iterator" is missing in the newer version. Is it deprecated ?? What is the alternative for it ? What I have tried: Tried searching for the...
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...
28 Oct 2018 by Member 13779003
Hello guys, Please can you help me? I have installed wamp server and I work on a project using bootstrap and php, the data which I insert into database is in Persian language, but when I retrieve my records on web application it shows me it like question marks I don't know what to do pls?? ...
6 Feb 2019 by IAmJoshChang
How to add the Invincible Power-Up Into The Game