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
#include <iostream> | |
template<class T> | |
struct BX | |
{ | |
T t; | |
}; | |
template<class T> | |
struct B { |
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
Modifier* FindPhysiqueModifier(AXNode* nodePtr) | |
{ | |
// Get object from node. Abort if no object. | |
Object* ObjectPtr =((INode*)nodePtr)->GetObjectRef(); | |
//DebugBox("* Find Physiqye Modifier"); | |
if (!ObjectPtr) return NULL; | |
// Is derived object ? |
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
// Вырезка из набора простых boundary test cases парсера C++ комментариев | |
// 2003-2005 (ц) Руслан "aruslan" Абдикеев | |
// Константы | |
std::cout << "C1. This is /* not a comment */\n"; | |
std::cout << "C2. This is // not a comment\n"; | |
std::cout << "C3. This is \" /* not a comment as well*/ \"\n"; | |
std::cout << "C4. This is \" // not a comment as well \"\n"; | |
std::cout << "C5. Let's print some random numbers: " << '/*' << '*/' << '\n'; | |
std::cout << "C6. Let's print a random number: " << '//' << '\n'; |
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
// Demonstration of the "Abdikeev's binary search padding effect": | |
// increasing the binary search performance by +30% | |
#include <algorithm> | |
#include <vector> | |
#include <iostream> | |
#include <assert.h> | |
#include <stdlib.h> | |
#include <time.h> | |
template<typename T> |
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
// Demonstration of the "Abdikeev's binary search padding effect": | |
// increasing the binary search performance by +30% | |
#include <algorithm> | |
#include <vector> | |
#include <iostream> | |
#include <cassert> | |
#include <cstdlib> | |
#include <ctime> |
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
#include <stdio.h> // Any parser should survive the standard i/o | |
struct t0 { typedef int a; }; | |
struct t1 : virtual t0 | |
{ | |
static const int a = 42; | |
int result(int b) const { return (a)-(b); } | |
}; | |
struct t2 : virtual t0 | |
{ |
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
-- | The 'permutations' function returns the list of all permutations of the argument. | |
-- | |
-- > permutations "abc" == ["abc","bac","cba","bca","cab","acb"] | |
permutations :: [a] -> [[a]] | |
permutations xs0 = xs0 : perms xs0 [] | |
where | |
perms [] _ = [] | |
perms (t:ts) is = foldr interleave (perms ts (t:is)) (permutations is) | |
where interleave xs r = let (_,zs) = interleave' id xs r in zs | |
interleave' _ [] r = (ts, r) |
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
/* Function to print permutations of string | |
This function takes three parameters: | |
1. String | |
2. Starting index of the string | |
3. Ending index of the string. */ | |
void permute(char *a, int i, int n) | |
{ | |
int j; | |
if (i == n) | |
printf("%s\n", a); |
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
#include <vector> | |
#include <algorithm> | |
#include <iostream> | |
#include <ostream> | |
#include <iterator> | |
template<typename T> | |
void print(const std::vector<T>& v) | |
{ | |
std::copy(v.begin(), v.end(), std::ostream_iterator<T>(std::cout)); |
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
struct foo | |
{ | |
explicit foo(int a) {} | |
explicit foo(const foo&) {} | |
}; | |
int main() | |
{ | |
foo a(42); | |
foo b = a; // breaks because the copy constructor is explicit |
OlderNewer