Language : C++
I am working on Bit Packing (Extracting the required bits from the given data and packing them in a char*) . My code currently supports :
- Integers
- Characters
- Strings
Now if I have to store the required bits of a structure, how should I go about it ? I mean what should I expect as input parameters for a generaliz...
Is there any way to inline just some selective calls to a particular function not all of them? cause only form I know is declaring function as such at beginning and that's supposed to effect all calls to that function.
...
Hi All
In my application i want to listen for any RUMBA/3270 (It is a 3270 emulator) screen update/event which i can capture and get the text/byte stream coming from mainframe. Once there i can use that stream for data mining.
In the RUMBA data-sheet they have mentioned that RUMBA 3270 emulator could be extended either by using EHLLAPI...
Is there any scope problem in this program?
#include<iostream>
using namespace std;
template<class Type>
class Base
{
public:
Type member;
Base(Type param): member(param){
}
};
template<class Type>
class Derived: public Base<Type>
{
public:
Derived(Type param):Base<Type>(param){
// ...
I'm teaching myself techniques of programming with exception safety mode of ;) and I wonder if dereferencing a pointer could ever throw an exception? I think it would be helpful for all C++ programmers to know all operations that are guarantied to not throw so I would be very grateful if someone could compose such list.
...
The following code works correctly under Windows XP:
CImage image;
RECT destRect;
int nResource = 10;
CResourceStream stream(0, MAKEINTRESOURCE(nResource), _T("JPEG"));
HRESULT hr = image.Load(&stream);
image.Draw(hDC, destRect);
But on Windows 7 image.Load returns E_FAIL though creating CResourceStream reads JPEG file from resou...
#include<iostream>
using namespace std;
class Abs
{
public:
virtual void hi()=0;
};
class B:public Abs
{
public:
void hi() {cout<<"B Hi"<<endl;}
void bye() {cout<<"B Bye"<<endl;}
};
class C:public Abs
{
public:
void hi() {cout<<"C Hi"<<endl;}
void sayonara() {cout<<"C Sayo...
I want to change wxMenu's Text color,but not MenuItem's text color.Thank you for your advices.
...
Why can I not do this?
boost::shared_ptr<QueuList> next;
void QueuList::SetNextPtr(QueuList* Next)
{
boost::mutex mtx;
boost::mutex::scoped_lock lock(mtx);
{// scope of lock
//if (next == NULL) // is this needed on a shared_ptr??
next = Next; // Why can I not assign a raw ptr to a shared_ptr????
}
}...
I have ubuntu 10.04 and want to install the latest boost library 1.44_0
I downloaded the tar.gz file and unpacked it into /usr/local/boost_1_44_0
I already have the boost 1.40 version install from synaptic.
So I want to compile and link against 1.44 because I'm wanting to use some new libraries that
are not in the older version such a...
Hi!
I'm working on a couple of classes and I'm wondering how I can use a normal member in my application class, where the member needs to use shared_from_this()?
Here is some code to clarify what I mean (see comments)
class Observable {
public:
void addObserver(boost::shared_ptr<Observer> observer) {
// add to a list
}...
// InternalTemplate.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
template<class T>
struct LeftSide
{
static void insert(T*& newLink, T*& parent)
{
parent->getLeft() = newLink;
newLink->parent = newLink;
}
};
template<class T>
struct Link
{
T* parent_;
T* left_;
T* right_;
T*& getParent()...
I was advised a while ago that is was common place to use std::vector as exception safe dynamic array in c++ rather than allocating raw arrays... for example
{
std::vector<char> scoped_array (size);
char* pointer = &scoped_array[0];
//do work
} // exception safe deallocation
I have used this convention multiple times wit...
If I want to copy the contents of a file to a vector, I can do it like that:
std::ifstream file("path_to_file");
std::vector<char> buffer(std::istream_iterator<char>(file),
std::istream_iterator<char>());
My question is, how would I do this if I want to copy only the first n chars?
Edit I could write my own ...
Hello,
I need to use STL C++ map to store key value pairs.
I need to store more than one data information in stl map.
e.g
Need to store DataType,Data and its behavior as(in param/outparam) all in string format.
But map always use key value pair
so if I
store it like
std::map<map<"int","50",>"behavior">.
But always it sorts the...
I've got some image processing code in C++ which calculates gradients and finds straight lines in them with the hough transformation algorithm. The program does most of the calculations with floats.
When I run this code on the same image on two different computers, one Pentium IV running latest Fedora, the other a Core i5 latest Ubuntu...
hello everyon, can somebody please explain, what exactly does it mean? I'm trying to understand what is the difference between clog and cerr, difference is only in buffering
thanks in advance
...
How do you create an intrusive slist (boost) that is threadsafe so that multiple threads can remove items or add items?
I'd want fairly fine grained locking; so I can lock only the necessary nodes and not the whole list each time.
Do I just write a wrapper class around boost slist or is it better to just implement it myself?
...
hello, what is the difference between these two terms, and why do I need mutable, thanks in advance for any help
...
In templates as shown below, I would like the call Run(&Base::foo) succeed without the need to name the Base type twice (as is done in the compiling Run<Base>(&Base::foo) call). Can I have that? Possibly without adding a ton of Boost headers?
With the provided code, I get an error of:
prog.cpp:26: error: no matching function for call t...