Hello
I've two classes (Negotiator, Client), both has their own boost::asio::ip::tcp::socket. Is there a way to transfer socket object to Client after negotiation is finished. I'm looking forward to do something like that:
boost::asio::ip::tcp::socket sock1(io);
//...
boost::asio::ip::tcp::socket sock2;
sock2.assign(sock1);
This...
I'm trying to lay out vertices using the Boost Graph Library. However, I'm running into some compilation issues which I'm unsure about. Am I using the BGL in an improper manner? My code is:
PositionVec position_vec(2);
PositionMap position(position_vec.begin(), get(vertex_index, g));
int iterations = 100;
double width = 100.0;
double he...
I am trying to use width and precision specifiers with boost::format, like this:
#include <boost\format.hpp>
#include <string>
int main()
{
int n = 5;
std::string s = (boost::format("%*.*s") % (n*2) % (n*2) % "Hello").str();
return 0;
}
But this doesn't work because boost::format doesn't support the * specifier. Boost th...
I'm trying to make a simple msn client mostly for fun but also for educational purposes. And I started to try some tcp package sending and receiving using Boost Asio as I want cross-platform support. I have managed to send a "VER"-command and receive it's response.
However after I send the following "CVR"-command, Asio casts an "End of ...
Code:
#include <iostream>
#include "stdafx.h"
#include <boost/thread.hpp>
#include <boost/thread/mutex.hpp>
using namespace std;
boost::mutex mut;
double results[10];
void doubler(int x) {
//boost::mutex::scoped_lock lck(mut);
results[x] = x*2;
}
int _tmain(int argc, _TCHAR* argv[])
{
boost::thread_group thds;
for (int x = 10; x>0...
Hi guys, I have some class which uses boost singleton. It calls some function from own c++ library. This library is written in make file as dependence.
Now I have another singleton class and it should call first singleton class. After this code I got linkers error about undefined references for functions which are used in first singleton...
Sorry for the confusing title. Let me explain via code:
#include <string>
#include <boost\function.hpp>
#include <boost\lambda\lambda.hpp>
#include <iostream>
int main()
{
using namespace boost::lambda;
boost::function<std::string(std::string, std::string)> f =
_1.append(_2);
std::string s = f("Hello", "There");
...
So I'm going nuts trying to figure this one out. Here's my basic setup:
I'm compiling a shared library with a bunch of core functionality that uses a lot of boost stuff. We'll call this library libpf_core.so. It's linked with the boost static libraries, specifically the python, system, filesystem, thread, and program_options librarie...
Follow-up to post: http://stackoverflow.com/questions/2978096/using-width-precision-specifiers-with-boostformat
I'm trying to use boost::function to create a function that uses lambdas to format a string with boost::format. Ultimately what I'm trying to achieve is using width & precision specifiers for strings with format. boost::forma...
I'm trying to compile qBittorrent on Windows using QtCreator/MingW.
http://qbittorrent.sourceforge.net/download.php
I need help with getting this to compile, but I'm fairly confused by these boost errors.
createtorrent_imp.cpp: In member function `virtual void torrentCreatorThread::run()':
createtorrent_imp.cpp:263: error: call of overl...
I am trying to make an asynchronised server in visual studio and I use
boost::asio::async_read(m_socket, boost::asio::buffer(m_buffer),
boost::bind(&tcp_connection::handle_read, shared_from_this(),
boost::asio::placeholders::error));
to get the buffer to be put in m_buffer ...
What's the difference between async_read and async_receive?
...
I have a TCP client connecting to my server which is sending raw data packets. How, using Boost.Asio, can I get the "whole" packet every time (asynchronously, of course)? Assume these packets can be any size up to the full size of my memory.
Basically, I want to avoid creating a statically sized buffer.
...
Hi,
At the moment I am trying to read in a timestring formatted and create a duration from that. I am currently trying to use the boost date_time time_duration class to read and store the value.
boost date_time provides a method time_duration duration_from_string(std::string) that allows a time_duration to be created from a time strin...
std::map< std::string , std::string > matrix_int;
typedef std::pair< std::string , std::string > lp_type;
BOOST_FOREACH( lp_type &row, matrix_int ){
}
this can not be complied:
error C2440: 'initializing' : cannot convert from 'std::pair<_Ty1,_Ty2>' to 'lp_type &'
when I have ',' in element type, boost doc says I can use typedef or p...
Hello,
I would like to see if you could orient me.
It happens that I compiled and referenced the boost libraries in order to use them with Visual Studio 2010. When building my test project I get these two IntelliSense errors
1 IntelliSense: #error directive: "Macro BOOST_LIB_NAME not set (internal error)" c:\boost_1_43_0\boost\confi...
I've currently got a class that can notify a number of other objects via callbacks:
class Callback {
virtual NodulesChanged() =0;
virtual TurkiesTwisted() =0;
};
class Notifier
{
std::vector<Callback*> m_Callbacks;
void AddCallback(Callback* cb) {m_Callbacks.push(cb); }
...
void ChangeNodules() {
for (iterator it=m...
Hi SO,
I wrote a client program and a server program, that uses the NTL library and Boost::Asio, to do client/server communication for an integer factorization application, in C++.
Both sides consist of several headers and cpp files. Both project compile fine individually on Windows in Visual Studio. All I did, was add the include path...
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!
1>Please define _WIN32_WINNT or
_WIN32_WINDOWS app...
I have a struct to store info about persons and multi_index_contaider to store such objects. Mult-index uses for search by different criteria.
I've added several persons into container and want to find person by lastname. It works great, if I use whole lastname. But it returns nothig if I try to find person by a part of a lastname (firs...