This file contains hidden or 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
| import std.stdio : File, fwrite; | |
| import std.math : sqrt; | |
| struct Header { | |
| align (1): | |
| short bitmap = 0x4d42; | |
| long fileSize; | |
| int headerSize = this.sizeof; | |
| int dataOffset = 40; | |
| int width; |
This file contains hidden or 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
| import core.runtime; | |
| import std.random; | |
| struct JNIEnv {} | |
| struct _jobject {} | |
| alias _jobject* jobject; | |
| alias int jint; | |
| extern (C) { | |
| void Java_Test_dinit(JNIEnv* env, jobject object) { |
This file contains hidden or 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
| mat3 Transform::rotate(const float degrees, const vec3& axis) { | |
| const float cosine = glm::cos(glm::radians(degrees)); | |
| const float one_minus_cosine = 1.0f - cosine; | |
| const float sine = glm::sin(glm::radians(degrees)); | |
| return glm::mat3(axis.x * axis.x * one_minus_cosine + cosine, | |
| axis.x * axis.y * one_minus_cosine + axis.z * sine, | |
| axis.x * axis.z * one_minus_cosine - axis.y * sine, | |
| axis.y * axis.x * one_minus_cosine - axis.z * sine, |
This file contains hidden or 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
| var fitAngle = function(angle) { | |
| return angle < 0 ? angle + 360 : angle; | |
| } | |
| function mirrorx() { | |
| var object = emblem.emblem.canvas.getActiveObject(), | |
| angle = object.get('angle'); | |
| object.set('angle', fitAngle(-object.get('angle'))); | |
| object.set('flipY', !object.get('flipY')); |
This file contains hidden or 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 NullType {}; | |
| template <typename T, typename U> | |
| struct TypeList { | |
| using Head = T; | |
| using Tail = U; | |
| }; | |
| template <typename...> struct MakeTypeList; |
This file contains hidden or 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
| #ifndef type_name_h | |
| #define type_name_h | |
| #include <string> | |
| #include <type_traits> | |
| #include <typeinfo> | |
| template<typename... T> struct type_name { | |
| static std::string get() { return {}; } | |
| }; |
This file contains hidden or 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 <unordered_map> | |
| #include <utility> | |
| #include <iostream> | |
| using namespace std; | |
| template<class T1, class T2> void fill(unordered_map<T1, T2>& m) {} | |
| template<class T1, class T2, class Key, class Value, class... Args> | |
| void fill(unordered_map<T1, T2>& m, Key&& key, Value&& value, Args&&... args) { |
This file contains hidden or 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> | |
| using namespace std; | |
| struct Foo { | |
| Foo() = default; | |
| Foo(const Foo&) { cout << "Foo::Foo(const Foo&)" << endl; } | |
| template<class T> Foo(const T&) { cout << "Foo::Foo<T>(const T&)" << endl; } | |
| }; |
This file contains hidden or 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> | |
| using namespace std; | |
| struct Foo { | |
| Foo() = default; | |
| Foo(const Foo&) { cout << "Foo::Foo(const Foo&)" << endl; } | |
| Foo(Foo&&) { cout << "Foo::Foo(Foo&&)" << endl; } | |
| template<class T> Foo(T&&) { cout << "Foo::Foo<T>(T&&)" << endl; } | |
| }; |
This file contains hidden or 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
| decltype(t) -> T forward<T>(t) after collapsing | |
| T& T& T& && (T& t) T& (T& t) | |
| T&& T& T& && (T&& t) T& (T&& t) - ill-formed | |
| T& T&& T&& && (T& t) T&& (T&& t) | |
| T&& T&& T&& && (T&& t) T&& (T&& t) |
OlderNewer