Is there a way to change the attribute of a file from read-only to read-write using the boost filesystem library? If not, what is the next-best way to do this on Windows (using Microsoft's C++)?
...
I'd like to compose two (or more) streams into one. My goal is that any output directed to cout, cerr, and clog also be outputted into a file, along with the original stream. (For when things are logged to the console, for example. After closing, I'd like to still be able to go back and view the output.)
I was thinking of doing somethin...
I'm trying to implement a weighted random numbers. I'm currently just banging my head against the wall and cannot figure this out.
In my project (Hold'em hand-ranges, subjective all-in equity analysis), I'm using Boost's random -functions. So, let's say I want to pick a random number between 1 and 3 (so either 1, 2 or 3). Boost's mersen...
I am using the boost filtering stream object to read gzipped files. Works great!
I would like to display a progress bar for the amount of the file that has been processed. I need find the input uncompressed file size. Does the gzip decompressor have access to the original file size from the gzipped file? I couldn't find it on the boo...
I'm trying to build the srecord tools for the native windows, http://srecord.sourceforge.net/windows.html. I execute, CC='gcc -mno-cygwin' CXX='g++ -mno-cygwin' ./configure. I get a failure as it is checking for boost libraries, see error text below. I installed the current verison of cygwin (as of 18-Nov-2009) including both the gcc and...
I just had a hell of a project doing simple operations on C++, then when I was almost completely done with the project I found out that all this stupid tasks required just a portion of boost. This was quite frustrating and let me wondering how many of these annoying problems could be solved with a single function of the boost libraries.
...
May I know is there any way to determine parent class from boost::any?
#include <iostream>
#include <boost/any.hpp>
class a {
public:
virtual ~a() {}
};
class b : public a {
};
bool is_class_a(const boost::any& any)
{
return boost::any_cast<a>(&any) != 0;
}
bool is_class_a_v2(const boost::any& any)
{
try
{
bo...
I am trying to build an application which depends on Boost. So I downloaded Boost 1_41_0 to my Linux box and followed the instructions found on the Boost site for Unix variants,
http://www.boost.org/doc/libs/1%5F41%5F0/more/getting%5Fstarted/unix-variants.html.
They basically suggest that I run ./bjam install, which I did. The build c...
I'm using boost::filesystem for cross-platform path manipulation, but this breaks down when calls need to be made down into interfaces I don't control that won't accept UTF-8. For example when using the Windows API, I need to convert to UTF-16, and then call the wide-string version of whatever function I was about to call, and then conve...
scoped_ptr is not copy able and is being deleted out of the scope. So it is kind of restricted shared_ptr. So seems besides the cases when you really need to restrict the copy operation shared_ptr is better to use. Because sometimes you don’t know you need to create a copy of your object or no. So the question is: besides the cases menti...
I have a problem with the functions in the string_algo package.
Consider this piece of code:
#include <boost/algorithm/string.hpp>
int main() {
try{
string s = "meißen";
locale l("de_DE.UTF-8");
to_upper(s, l);
cout << s << endl;
catch(std::runtime_error& e){
cerr << e.what() << endl;
}
try{
...
Hai friends,
I've installed boost python from ubuntu 9.04 repositories.. I've successfully run the
Build a Simple Program Using Boost
from the tutorial http://www.boost.org/doc/libs/1%5F41%5F0...-variants.html . So i ensured that boost python is installed in my system..
But for the program below
#include <string>
namespace { // Avoid ...
I have the following code snippet. I am compiling using the sun studio 12 compiler and have tried boost 1.33 and 1.39
#include <boost/algorithm/string.hpp>
#include <string>
#include <vector>
using namespace boost;
using namespace std;
int main(int argc, char* argv[])
{
string exbyte = "0x2430";
string exbytes = "0x2430,2430...
hi am trying to compile a simple program in boost library but i keep getting linker errors
#include <iostream>
#include <string>
#include <boost\regex.hpp> // Boost.Regex lib
using namespace std;
int main( ) {
std::string s, sre;
boost::regex re;
while(true)
{
cout << "Expression: ";
cin >> sre;
if (...
Currently, I am using a type-safe enum class from Boost Vault :
http://stackoverflow.com/questions/217549/which-typesafe-enum-in-c-are-you-using
I found it is difficult to have a parent class pointer to refer to all enum class, due to Boost::enum is a template class : boost::detail::enum_base<T>
I am using void fun(const boost::any& a...
Hi,
I am going through the boost::asio examples. I am looking at
Example 4
What is confusing is that, the WaitHandler in this example has the signature
void print (this)
But the async_wait call expects a handler whose
function signature of the handler must be:
void handler(
const boost::system::error_code& error ...
Hello World Code
#include <boost/python.hpp>
using namespace boost::python;
struct World{
void set(std::string msg) { this->msg = msg; }
std::string greet() { return msg; }
std::string msg;
};
BOOST_PYTHON_MODULE(hello)
{
class_<World>("World")
.def("greet", &World::greet)
.def("set", &World::set)
;...
Right now I'm generating a random enumerator using boost's random library. Basically I'm using an implicit conversion to specify the random generator's distribution, getting a random number, and then casting that back to the enumerated type.
Ex: (minColor and maxColor are parameters of the enumerated type)
boost::mt19937 randGen(std::t...
Okay so basically :
i have this simple example:
main.cpp
using namespace VHGO::Resource;
std::list<BaseTable*> tableList;
BigTable* bt1 = new BigTable();
HRESULT hr = S_OK;
hr = bt1->Add(L"TEXTURE", L"..\\Data\\ground.png");
tableList.push_back(bt1);
std::wofstream ofs3(L"VHGOSatData.bif");
boost::archive::xml_woarchive outArch3(of...
I want to get started using Boost. I'm programming a C++ program in Visual Studio (obviously on a Windows machine).
Boost's Getting Started Guide says:
The easiest way to get a copy of Boost is to use an installer. The Boost website version of this Getting Started guide will have undated information on installers as they become avai...