Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Dynamically allocated array in unique_ptr with custom deleter.
//clang 3.8.0 #include <iostream> #include <memory> // This is just to make it compile. Ignore extern void *pffft_aligned_malloc(size_t nb_bytes); extern void pffft_aligned_free(void *); // int main() { // Don't actually want to call this :) if (false) { auto deleter=[&](float* ptr){ pffft_aligned_free(ptr); }; auto floatArray = std::unique_ptr<float[], decltype(deleter)>(static_cast<float*>(pffft_aligned_malloc(1234)), deleter); } std::cout << "Hello, world!\n"; }
run
|
edit
|
history
|
help
0
Standard Template Library
Fun with Pointers #1
C++ Operator Overloading
Clang-IsBaseOf
SubsequenceArray
Unlike C (even C99/C11), C++ allows initializers in if-conditions, so this compiles.
Throttle Example (Send two requests every two seconds)
ternary test
Example
DESim Example Starter Code