I'm kinda stuck with parsing of date/time strings. Help would be greatly appreciated.
Input: strings with date and optional time. Different representations would be nice but necessary. The strings are user-supplied and can be malformed. Examples:
- "2004-03-21 12:45:33" (I consider this the default layout)
- "2004/03/21 12:45:33" (o...
I'm looking for some style advice for testing this piece of (Objective-)C++ code, I bracketed the Objective part, as I don't think it should have any bearing on this test.
class Probe
{
public:
bool playing();
}
bool Probe::playing()
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
iTunesApplication *iTunes = [S...
I try to send some struct into STL list;
struct obj {
int a;
int b;
}
list < struct obj> mylist;
struct obj a = { 0, 1};
mylist.push_back ( a);
Is there any other way to initialize argument of push_back?
For example:
mylist.push_back ( struct obj a ={0, 1});
g++ tells me: expected primary-expression before "struct";
...
I have a linked list of structures. Lets say I insert x million nodes into the linked list,
then I iterate trough all nodes to find a given value.
The strange thing is (for me at least), if I have a structure like this:
struct node
{
int a;
node *nxt;
};
Then I can iterate trough the list and check the value of a ten ...
I've been playing with clang a while, and I stumbled upon "test/SemaTemplate/dependent-template-recover.cpp" (in the clang distribution) which is supposed to provide hints to recover from a template error.
The whole thing can be easily stripped down to a minimal example:
template<typename T, typename U, int N> struct X {
void f(T* ...
Hi,
is there a multiplatform c++ compiller that could be linked into any software ?
Lets say I want to generate c++ code at runtime, compile it and run it.
I'm looking for a compact solution (bunch of classes), preferably LGPL/BSD licence :)
As far as I know it can be done in Java and c#. What about c++ ?
Thanks
...
I have started using BOOST recently for unit testing.
Just need one clarification on global fixtures.
When it got executed? ... for each test module, or each test suite or each test case?
Will it be the first before any thing else got executed?
I am using the BOOST_AUTO_TEST_CASE for writing my tests.
...
I am having a very strange problem in a simple program and have been unable to reach any logical conclusion. When I redirect output from my program to a file, then I get a different result that I get when printing to stdout. When I print to a file, the result is correct. I don't understand why it would be different in the first place. He...
C++03 $14.1/6 - "A non-type
non-reference template-parameter is
not an lvalue."
C++0x $14.2/6- "A non-type
non-reference template-parameter is an
rvalue."
Is there any specific rationale behind rewording it?
...
Hi,
I've got confused by the fact that this code works:
struct S
{
char c[];
};
S s;
According to C++ standard, chapter 8.3.4:
"If the constant
expression is omitted, the type of the
identifier of D is
“derived-declarator-type-list array of
unknown bound of T”, an incomplete
object type."
But I cannot figure out how...
I know by default report is directed to standard-error, and so one has to redirect it to a file.
My question is shall we do this inside a global fixture? Which isn't seem to be working for me some how.
This is what i tried -
struct MyConfig
{
MyConfig()
: testReport("fileName.log")
{
if(!testReport.fail())
original = std...
Can someone explain the difference between a C++ exception and a structured exception in MFC?
...
I've been playing around with type deduction/printing using templates with code of the form:
#include <iostream>
template <typename T>
class printType {};
template <typename T>
std::ostream& operator<<(std::ostream& os, const printType<T>&)
{
os << "SomeType"; return os;
}
template <typename T>
std::ostream& operator<<(std::ostr...
While Trying to create a Menu to SubMenu using InsertMenuItem:
MENUITEMINFO mii = { sizeof(MENUITEMINFO) };
mii.fMask = MIIM_SUBMENU | MIIM_STRING | MIIM_ID;
mii.wID = uCmdID++;
mii.hSubMenu = hSubmenu;
mii.dwTypeData = _T("Net&Work Drive Solution");
// InsertMenu ( hmenu, uMenuIndex, MF_BYPOSITION | MF_POPUP,
// (UINT_...
Given a C++ template class (or function) definition:
template<typename T>
struct Foo {
T member;
};
-- if in a more complicated case I want to make the typename more expressive, what case naming conventions are accepted or shunned (and why). Examples:
template<typename MORE_EXPRESSIVE_NAME>
struct More {
MORE_EXPRESSIVE_NAME* p_;...
Hey!
I have a class called SparseMatrix which contain a private vector of type Cell.
Cell is a structure that should hold x,y coords and a double value.
In addition, I would like that a different class called RegMatix will be able to declare a vector of type Cell also.
this is the struct:
struct Cell {
Cell(int row,int col, Numbe...
I just got into a new company and much of the code base uses initialization methods instead of constructors.
struct MyFancyClass : theUberClass
{
MyFancyClass();
~MyFancyClass();
resultType initMyFancyClass(fancyArgument arg1, classyArgument arg2,
redundantArgument arg3=TODO);
// several ...
From here,
Using inheritance, which of the following is not allowed
a) Changing implementation of operation in parent by the subclass
b) Using implementation of operation in parent class by the subclass
c) Using attributes in parent class by the subclass
d) Having operations is subclass which do not exist in parent class
e) None
A...
i go to projetctproperties -> run -> arguments i pass a filename but where do i have to place the file?
...
I have a library which expects a array and fills it. I would like to use a std::vector instead of using an array. So instead of
int array[256];
object->getArray(array);
I would like to do:
std::vector<int> array;
object->getArray(array);
But I can't find a way to do it. Is there any chance to use std::vector for this?
Thanks for r...