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
| namespace bbb { | |
| template <typename type> | |
| struct is_null_pointer : std::false_type {}; | |
| template <typename type> | |
| using is_null_pointer_t : get_type<is_null_pointer<type>>; | |
| template <> | |
| struct is_null_pointer<std::nullptr_t> : std::true_type {}; | |
| template <typename ...> |
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
| #!/bin/bash | |
| clang++ -c -std=c++11 -stdlib=libc++ main.cpp | |
| clang++ -c -std=c++11 -stdlib=libc++ sub.cpp | |
| clang++ main.o sub.o -o main |
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> | |
| int f(int x) { | |
| std::cout << "true f" << std::endl; | |
| return 0; | |
| } | |
| namespace bbb { | |
| struct function_is_not_exist {}; | |
| function_is_not_exist f(...) { 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
| defmodule Brainfuck do | |
| @seek_next ?> | |
| @seek_prev ?< | |
| @inc_head ?+ | |
| @dec_head ?- | |
| @print_head ?. | |
| @read_input ?, | |
| @loop_begin ?[ | |
| @loop_end ?] | |
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
| set i to 1 | |
| repeat while true | |
| say {"羊が", i, "匹"} as string using "Kyoko" | |
| set i to i + 1 | |
| delay 1 | |
| end repeat |
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 <cmath> | |
| namespace bbb { | |
| namespace autodiff { | |
| template <typename type> | |
| struct dual { | |
| inline static dual make(type x) { return dual(x); }; | |
| inline static dual scalar(type x) { return dual(x, 0.0); }; | |
| constexpr dual(type x, type dx = type(1.0)) noexcept |
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
| #!/bin/bash | |
| clang++ -Wall impl.cpp sub.cpp -o impl.a -std=c++11 | |
| ./impl.a |
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> | |
| template <typename type, typename tag = type> | |
| struct inline_variable { | |
| static type &get(const type &initial_value) { | |
| static type _{initial_value}; | |
| 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 <utility> | |
| namespace bbb { | |
| namespace infix_op { | |
| template <typename function_type> | |
| struct infix_op { | |
| inline infix_op() : f() {}; | |
| template <typename ... arguments> | |
| inline infix_op(arguments ... args) : f(std::forward<arguments>(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 <cstddef> | |
| #include <cstdint> | |
| #include <type_traits> | |
| #include <functional> | |
| namespace bbb { | |
| namespace { | |
| template <bool b, typename type> | |
| using enable_if_t = typename std::enable_if<b, type>::type; | |
| }; |