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
http://stackoverflow.com/questions/2898316/using-a-member-function-pointer-within-a-class | |
//char *buffer = new char[bufferSize]; | |
std::string buffer; | |
buffer.resize(bufferSize); |
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
using namespace foo; //generic, the same behaviour in Java, include com.foo.* | |
using bar;// specific, the same behaviour in Java, include com.package.bar; |
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
void Foo( int * ptr, | |
int const * ptrToConst, | |
int * const constPtr, | |
int const * const constPtrToConst ) | |
{ | |
*ptr = 0; // OK: modifies the "pointee" data | |
ptr = NULL; // OK: modifies the pointer | |
*ptrToConst = 0; // Error! Cannot modify the "pointee" data | |
ptrToConst = NULL; // OK: modifies the pointer |
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 throttle( fn, time ) { | |
var t = 0; | |
return function() { | |
var args = arguments, ctx = this; | |
clearTimeout(t); | |
t = setTimeout( function() { | |
fn.apply( ctx, args ); | |
}, time ); | |
}; |
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
typedef int myinterger; | |
typedef int (*fn_adder)(int, long); | |
int sum(int a, long b){ | |
return a+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
/* | |
* This function will replace the content inside | |
* the commentary "setupVars" | |
* | |
* Param: | |
* content: the input string, e.g, a entire HTML file | |
* data: snippet to be included | |
* | |
* <html> | |
* <body> |
NewerOlder