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 <random> | |
| #include <iostream> | |
| #include <iomanip> | |
| #include <vector> | |
| #include <list> | |
| #include <forward_list> | |
| #include <map> | |
| #include <unordered_map> | |
| #include <algorithm> | |
| #include <chrono> |
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
| material_t( aiMaterial* material, const std::string& path_prefix = "" ) | |
| { | |
| // マテリアルカラー | |
| { | |
| aiColor3D result; | |
| if( material -> Get( AI_MATKEY_COLOR_DIFFUSE, result ) == aiReturn_SUCCESS ) | |
| _diffuse = { result.r, result.g, result.b }; | |
| if( material -> Get( AI_MATKEY_COLOR_AMBIENT, result ) == aiReturn_SUCCESS ) | |
| _ambient = { result.r, result.g, result.b }; | |
| if( material -> Get( AI_MATKEY_COLOR_SPECULAR, result ) == aiReturn_SUCCESS ) |
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 <map> | |
| #include <string> | |
| #include <iostream> | |
| auto main() -> int | |
| { | |
| // ある値の近傍2点を求めたい map がありました。 | |
| const std::map< double , std::string > m = { {0.0, "hello"}, {0.111,"world"}, {0.234, "!!!!"} }; | |
| // upper_boundである値に対して「より大きい」キーのイテレーターを取得しました。 | |
| auto upper_bound = m.upper_bound( 0.110 ); |
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
| <?php | |
| echo "More hello, world"; | |
| ?> |
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
| // 標準入出力やエラー出力を扱うためのC++標準ライブラリーの読み込み | |
| #include <iostream> | |
| // 1. main関数に int argc, char** argv は使わないのなら要らない | |
| // 2. C++11以降では関数を int main() { } の代わりに auto main() -> int { } と書ける。テンプレートが絡んだ時に都合の良い事があるらしい。 | |
| // 3. C++のmain関数では特例的に返り値をreturnしなくてもデフォルト動作として return 0; がある事になるからもし return 0; で良いならば省略して良い。 | |
| auto main() -> int | |
| { | |
| // <iostream>で定義されるC++標準の標準出力にストリーム出力を行う。 | |
| // << は実は単なるバイナリーオペレーターで、 |
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
| // C# | |
| using System; | |
| public class Test | |
| { | |
| public static void Main() | |
| { | |
| var one = 1; | |
| var two = 2; |
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
| <?php | |
| $user_input = readline('amidakuji > '); | |
| echo $user_input; |
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
| function readline_ex( $prompt ) | |
| { | |
| switch ( substr( PHP_OS, 0, 3 ) ) | |
| { | |
| case 'WIN': | |
| echo $prompt; | |
| file_put_contents('tmp.bat', '@set I='.PHP_EOL.'@set /p I='.PHP_EOL.'@echo %I%'); | |
| $user_input = trim( `tmp.bat` ); | |
| unlink('tmp.bat'); | |
| return $user_input; |
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
| <?php | |
| function add( $params ) | |
| { | |
| echo array_reduce( $params, function( $carry, $param ){ return $carry + $param; } ).PHP_EOL; | |
| } |
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
| <?php // Reflection example | |
| trait fuga_t | |
| { | |
| public function eee() { echo 'hello eee'.PHP_EOL; } | |
| } | |
| final class hoge_t | |
| { | |
| use fuga_t; |