boost

strange error with boost::iostreams::gzip_decompressor in c++

。_饼干妹妹 提交于 2020-04-17 07:52:54
问题 all I am developing to compress and decompress with boost in c++. my codes are below: #include <stdio.h> #include <vector> #include <string> #include <fstream> #include <iostream> #include <boost/iostreams/filtering_streambuf.hpp> #include <boost/iostreams/copy.hpp> #include <boost/iostreams/filter/gzip.hpp> char *txtFile = "D:/Temp/plainTest.txt"; char *txtFile2 = "D:/Temp/plainTest_.txt"; char *binFile = "D:/Temp/plainTest.bin"; // compress std::ifstream inStream(txtFile, std::ios_base::in)

How to set max recursion in boost spirit

北慕城南 提交于 2020-04-14 02:58:34
问题 Using boost::spirit, if I have a recursive rule to parse parentheses rule<std::string::iterator, std::string()> term; term %= string("(") >> *term >> string(")"); how do I limit the maximum amount of recursion? For example, if I try to parse a million nested parentheses, I get a segfault because the stack size has been exceeded. To be concrete, here is a complete sample. #include <iostream> #include <string> #include <boost/spirit/include/qi.hpp> int main(void) { using namespace boost::spirit

How to set max recursion in boost spirit

好久不见. 提交于 2020-04-14 02:58:11
问题 Using boost::spirit, if I have a recursive rule to parse parentheses rule<std::string::iterator, std::string()> term; term %= string("(") >> *term >> string(")"); how do I limit the maximum amount of recursion? For example, if I try to parse a million nested parentheses, I get a segfault because the stack size has been exceeded. To be concrete, here is a complete sample. #include <iostream> #include <string> #include <boost/spirit/include/qi.hpp> int main(void) { using namespace boost::spirit

How to avoid firing already destroyed boost::asio::deadline_timer

瘦欲@ 提交于 2020-04-13 17:16:12
问题 I'm using multiple boost::asio::deadline_timer on one io_service object. std::shared_ptr of boost::asio::deadline_timer are stored in the container std::map<int, std::shared_ptr<debug_tim>> timers with index. In the timer handler, I erase other boost::asio::deadline_timer . However, it seems that the erased timer woule be often fired with success error code. Is there any way to avoid that. I expect that the timer handler that corresponding to the erased boost::asio::deadline_timer always

why has uBLAS no `operator*(matrix, vector)`?

一世执手 提交于 2020-04-10 22:39:11
问题 In the doc, they say We decided to use no operator overloading for ... They provide prod instead for these. But why? Is there any good reason? I like to do matrix * vector (as in most other languages). I like to understand why they did not overloaded this operator to understand why it might be a bad idea to just do it myself. Or aren't they any drawbacks if I overload it myself? 回答1: Probably, because op* in other languages, e.g. with Numpy in Python, will always be element-wise. In case that

io_context.run() in a separate thread blocks

折月煮酒 提交于 2020-04-07 08:49:33
问题 I have a RESTServer.hpp implemented using boost.beast as shown below. #pragma once #include <boost/property_tree/json_parser.hpp> #include <boost/beast/core.hpp> #include <boost/beast/http.hpp> #include <boost/beast/version.hpp> #include <boost/asio.hpp> #include <chrono> #include <cstdlib> #include <ctime> #include <iostream> #include <memory> #include <string> namespace beast = boost::beast; namespace http = beast::http; namespace net = boost::asio; using tcp = boost::asio::ip::tcp; class

VS2015 : The application was unable to start correctly (0xc000007b)

柔情痞子 提交于 2020-04-05 19:17:37
问题 I wrote a code on Visual studio 2015 for a windows 10 PC. The application is mainly focused on UDP communication and I use the boost libraries. It works perfectly but when I move the folder of the code to Windows 7 I receive the error "The application was unable to start correctly (0xc000007b)". I tried also in Windows 8.1 and after rebuilding the libraries it works. What I noticed is that when I receive the error it does not load the .dll that in the other versions it loads. May it be a

VS2015 : The application was unable to start correctly (0xc000007b)

不问归期 提交于 2020-04-05 19:16:17
问题 I wrote a code on Visual studio 2015 for a windows 10 PC. The application is mainly focused on UDP communication and I use the boost libraries. It works perfectly but when I move the folder of the code to Windows 7 I receive the error "The application was unable to start correctly (0xc000007b)". I tried also in Windows 8.1 and after rebuilding the libraries it works. What I noticed is that when I receive the error it does not load the .dll that in the other versions it loads. May it be a

VS2015 : The application was unable to start correctly (0xc000007b)

六眼飞鱼酱① 提交于 2020-04-05 19:15:14
问题 I wrote a code on Visual studio 2015 for a windows 10 PC. The application is mainly focused on UDP communication and I use the boost libraries. It works perfectly but when I move the folder of the code to Windows 7 I receive the error "The application was unable to start correctly (0xc000007b)". I tried also in Windows 8.1 and after rebuilding the libraries it works. What I noticed is that when I receive the error it does not load the .dll that in the other versions it loads. May it be a

C++ add 1 year to date

陌路散爱 提交于 2020-03-21 03:47:13
问题 This is how im generating my date i want to add 1 year to it. Thanks in advance. char tmpbuf[128]; time_t ltime; struct tm *today; stringstream reD; string todayDate; time( &ltime ); today = localtime( &ltime ); strftime( tmpbuf, 128,"%Y-%m-%d_%H:%M:%S", today ); reD << tmpbuf; reD >> todayDate; boost::replace_all(todayDate, "_", " "); cout << todayDate << endl; OK ive decided to go with boost since it will be easier to add days, so 2 examples i need one to add 1 year, and one to add 14 days,