Hello All,
I need to generate all permutation of a string with selecting some of the elements. Like if my string is "abc" output would be { a,b,c,ab,ba,ac,ca,bc,cb,abc,acb,bac,bca,cab,cba }.
I thought a basic algorithm in which I generate all possible combination of "abc" which are {a,b,c,ab,ac,bc,abc} and then permute all of them.
S...
Hi all.
I am programmer already two years and I know C++,C#,PHP,JS,MySQl,....languages.
But besides these I can play piano and violin very well.
I want to know is there any musical applying in field of programming?
THANKS
...
I want to store pointers to one instance of an object in some (two or more) containers. I've met one problem in this idea: how I can handle removing of this object. Objects have rather stormy life (I am talking about game, but I think this situation is not so specific) and can be removed rather often. To my mind this problem is divided i...
My question is related to this.
I wanted to perform a sort() operation over the set with the help of a lambda expression as a predicate.
My code is
#include <set>
#include <string>
#include <iostream>
#include <algorithm>
int main() {
using namespace std;
string s = "abc";
set<string> results;
do {
for (int n = 1; n <= s....
I'm using CMake to create a visual studio project as I'm making a cross platform application and library, but I get errors like:
1>c:\program files\microsoft visual studio 10.0\vc\include\wchar.h(109): warning C4820: '_wfinddata64i32_t' : '4' bytes padding added after data member '_wfinddata64i32_t::attrib'
It compiles fine on GNU/...
If the answer is yes, can you tell me why? here is an example:
namespace urx {
struct reserved { };
struct side { urx::reserved reserved() { /*...*/ } };
}
int main() {
urx::side side;
side.reserved();
}
reserved is used for both a type name and a function name.
side is used for both a type name and a variable name.
b...
Hi I wonder,
Is it necessary to use reinterpret_cast< char*> when reading from a binary file. Since I found that a explicit typecast worked as well e.g. (char*), sizeof(int).
...
I have been tasked with maintaining a legacy unmanaged c++ system. I do not have access to the source of the entire system but I do have the source to a number of extension dlls that, when included in the same directory as the core system, will be loaded instead of the built in defaults.
I have used the extensions in the past for small...
Robot judges suck! I've been accepted by UVA, only after removing the following chunks of code:
cin >> ntc;
/* extract newline from previous read */
char dummy(0);
cin.get(dummy);
assert( '\n'==dummy );
/* newline extract completes */
Replacing it with :
cin >> ntc;
getline( cin, inputN ); /* extract remaining '\n' */
Before replac...
As i understood, template value need to be known in compilation time.
so i write a little example just to see that i get it, but apperantly i didn't.
so i get this:
`defValue' cannot appear in a constant-
expression
can anyone please what is the problem and how it can be fixed?
#include <iostream>
template <class T,T defaultVal, int...
Is there any macro that can get a text as input like "abc" and by text I literally mean text like the one mentioned not an array or anything else, then extract characters of that text and generate a selective piece of code like ones below at compile time:
first example of a piece of code :
Func1(a);
Func2(b);
Func3(c);
second example ...
Reading the book I found the following:
The way of thinking when you model the problem by its single elements its the base of objected oriented programming.
Also when I want to make a game (e.g.), the player is one element, the level is one element? Those are just basic elements which my application logic consists of?
It also says ...
let's say there is a dummy struct called foo_boolen and contains some boolen values as below
struct fool_boolen {
bool b1;
bool b2;
};
then, if I defined a variable of fool_boolen without initializing, what will be default value of the boolen variable in it? true, false or just a ramdom value of the two.
...
Hi,
is it possible to view the value of a Mutex or Semaphore in Watch winodw in debug mode?
...
Given image is N*M (R,G,B) pixels like:
Algorithm should tall us how to find main image colors like: red and white here.
Aeries with relatively same colors means we search for (R,G,B) (222, 12, 10) giving for example such step (40, 20, 10 ) so that (199, 32, 5) will count like what we are searching for like:
Shapes should be de...
Why compiler cannot specialize this function and is there a way to force him to do so?
The error I'm getting:
Error 1 error C2893: Failed to specialize function template ''unknown-type' Ternary::check(bool,Left,Right)'
#include "stdafx.h"
#include <iostream>
#include <string>
using std::cout;
using std::string;
template<int v>
stru...
Possible Duplicates:
C++, removing #include<vector> or #include<string> in class header
Forward declare an STL container?
I want to forward declare std::string, by the way, can I forward declare a struct?
...
Possible Duplicate:
What are the differences between struct and class in C++
http://www.cplusplus.com/reference/std/typeinfo/type_info/
I guess my "teacher" didn't tell me a lot about the differences between struct and classes in C++.
I read in some other question that concerning inheritance, struct are public by default... ...
Hi!
Does anybody know of a better/ faster way to get the call stack than "StackWalk"?
I also think that stackwalk can also be slower on methods with a lot of variables...
(I wonder what commercial profilers do?)
I'm using C++ on windows. :)
thanks :)
...
Hi,
I'd like to create a toolbar that contains main menu, just like the standard main menu
at the top of the window.
Is there some fast way to do this in QT ? I know that I can create a toolbar with buttons and context menus :-)
Thx for help.
...