This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
freopen("NUL", "a", stdout); //redirect stdout to null again | |
dup2(stdout_save, STDOUT_FILENO); //restore the previous state of stdout | |
setvbuf(stdout, NULL, _IONBF, MDT_BUFSIZE); //disable buffer to print to screen instantly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int stdout_save; | |
char buffer[BIG_ENOUGH]; | |
fflush(stdout); //clean everything first | |
stdout_save = dup(STDOUT_FILENO); //save the stdout state | |
freopen("NUL", "a", stdout); //redirect stdout to null pointer | |
setvbuf(stdout, buffer, _IOFBF, 1024); //set buffer to stdout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Individual { | |
public: | |
Individual& operator= (Individual &target); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Individual { | |
public: | |
Individual& Individual::operator= (Individual &target); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ClassC *ClassCInstance = new ClassC(); | |
for (i = 0; i < 10; ++i) { | |
myVector.push_back(ClassA(ClassCInstance)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ClassB { | |
private: | |
std::vector<ClassA> myVector; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ClassA { | |
public: | |
ClassA(ClassC *pointer_to_ClassC); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MyClass.h | |
class MyClass { | |
public: | |
static int GetVar() { | |
return shared_variable; | |
} | |
private: | |
static int shared_variable; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//USE THIS | |
while (cName->hasChildren()) { | |
QList<QStandardItem*> listOfItems = cName->takeRow(0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//DO NOT USE THIS | |
QStandardItem *cName; | |
for (int k = 0; k < cName->rowCount(); ++k) { | |
QList<QStandardItem*> listOfItems = cName->takeRow(k); | |
} |