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
template < typename T > | |
T max(T a, T 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
namespace A | |
{ | |
void f(){std::cout << "A" << std::endl;}; | |
void hoge(){ | |
f(); // 名前空間の中では修飾しなくても呼び出せる | |
} | |
} | |
namespace 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
int max( int a, int b ) // #1 | |
{ | |
return a < b ? b : a ; | |
} | |
double max( double a, double b ) // #2 | |
{ | |
return a < b ? b : a ; | |
} |
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
template < typename T > | |
constexpr T interval<T>::rad() const | |
{ | |
return pimpl->upper() - pimpl->lower() / static_cast<T>(2.0L); | |
} | |
template < typename T > | |
constexpr T interval<T>::norm() const | |
{ | |
using std::abs; |
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
#include <iostream> | |
#include <string> | |
#include <algorithm> | |
#include <vector> | |
#include <map> | |
template < typename Container > | |
auto my_find(Container& c, typename Container::key_type key) | |
->decltype((c.find(key))) | |
{ |
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
std::is_same<T,U>::value |
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
template < typename T > | |
void f(T&&){} | |
void g(int const&){}; | |
int main(){ | |
f(g); | |
} |
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
#include <iostream> | |
#include <functional> | |
#include <vector> | |
#include <initializer_list> | |
#include <utility> | |
#include <tuple> | |
#include <memory> | |
namespace cranberries { |
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
std::random_device rd{}; | |
std::cout << rd() << std::endl; |
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
// 変数がいっぱいある | |
int a{}, b{}, c{}; | |
double d{}, e{}, f{}; | |
std::string too_long_name_variable{}; | |
// ラムダ式 | |
auto result = [&a,&b,&c,&d,&e,&f,&too_long_name_variable](auto&& ...args){ | |
// ... | |
// 何らかの処理 | |
// ... |
OlderNewer