From Boost::Thread:
template <typename R>
class shared_future
{
...
// move support
shared_future(shared_future && other);
shared_future(unique_future<R> && other);
shared_future& operator=(shared_future && other);
shared_future& operator=(unique_future<R> && other);
...
}
What on earth are those double-ampersands ? I went over "BS Th...
Can a float value be used as the index of an array? What will happen if an expression used as an index resulted to a float value?
...
Hi All,
I currently have a solution in VS 2005 which I attempted to trim down as it currently contains 150+ projects. As I don't know the solution that well, I am looking at set info, such as the references and the project dependencies within the solution.. In doing so, I have been able to remove approx 15-20 projects from the solution ...
The following code gives an compilation error for void b() { m = &A::a; }; stating that A::a() is protected. (Which it is - but that should be no problem)
However the compiler doesn't care when I write B::a(). Even though both mean the same I would prefer A::a() because it states explicitely that a() is defined in A.
So what is the reas...
Hi!
How can I remove last character from a C++ string?
I tried st = substr(st.length()-1); But it didn't work.
...
Is there a maximum number of characters allowed in a string? If so, what is the limit on the number of characters?
...
I have a templated base class which follows:
template<class scalar_type, template<typename > class functor>
class convex_opt{ ..
};
How to derive a class from this templated class?
...
What are the advantages of using dynamic memory allocation to create an array compared to the ordinary allocation of elements in an array?
...
I try to deal with SQLite database on Qt 4.5.3 on Linux. I've already created DB with another program and it looks like this:
screenshot
Then, I try to perform select on Qt:
db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName(filename); // Here is FULL path to the database. I've checked it twice :)
bool ok = db.open();
qDebug...
Hi all,
I am just wondering if there are any usefuls tools out there that allow me to exploit the Instruction-Level-Parallelism in some algorithms. More specifically, I have a subset of
algorithms from the multimedia domain and I wonder what is the best way to exploit ILP
in this algorithms. All this algorithms are implemented in C, so ...
I want to write to a std::stringstream without any transformation of, say line endings.
I have the following code:
void decrypt(std::istream& input, std::ostream& output)
{
while (input.good())
{
char c = input.get()
c ^= mask;
output.put(c);
if (output.bad())
{
throw std::ru...
class A {
A() { }
};
class B : public A {
B() : A() { }
};
Why do we need to call the base class's constructor explicitly inside B's constructor? Isn't it implicit?
...
I've got a map that stores a simple struct with a key. The struct has two member functions, one is const the other not. I've managed calling the const function using std::for_each without any problems, but I've got some problems calling the non-const function.
struct MyStruct {
void someConstFunction() const;
void someFunction();
};...
I have the following map structure: map < pair < int,int >, object* > and I wish to insert into it. How would I do it since I am trying to insert a pair and an object and I must make a pair out of this. Should I create a new pair using make_pair() out of the pair and object that I have? If so, could you please let me know how to do this?...
I am writing an application that allows Syncing to USB storage devices and I would like to display the FriendlyName for the devices that can be found in the registry at HKLM\SYSTEM\CurrentControlSet\Enum\USBSTOR\
I am using GetLogicalDrives to get the list of available devices, GetDriveType to filter by DRIVE_REMOVABLE and GetVolumeInfo...
Talking about strings in C++, what is the difference between the following statements: s1=s2 and strcpy (s1, s2)? Supposing that s1 and s2 are (original version: type 'char', as revised) type char *.
...
If you've used CPPUnit before, you are probably aware of its assertion_traits class that is templatized to handle arbitrary types. This is what allows it to print the "actual" and "expected" values for non-string types when test cases fail. I have used this with success several times, but for one specific type it isn't working for me. ...
Do any of the popular C++ libraries have a class (or classes) that allow the developer to use arrays with arbitrary indices without sacrificing speed ?
To give this question more concrete form, I would like the possibility to write code similar to the below:
//An array with indices in [-5,6)
ArbitraryIndicesArray<int> a = ArbitraryIndi...
Is there a way to perform this in VB.NET like in the C-Style languages:
struct Thickness
{
double _Left;
double _Right;
double _Top;
double _Bottom;
public Thickness(double uniformLength)
{
this._Left = this._Right = this._Top = this._Bottom = uniformLength;
}
}
...
Hi
I have a libpthread linked application. The core of the application are two FIFOs shared by four threads ( two threads per one FIFO that is ;). The FIFO class is synchronized using pthread mutexes and it stores pointers to big classes ( containing buffers of about 4kb size ) allocated inside static memory using overloaded new and del...