C++
ä½ã ããã ã§C++ãæ¸ãç¶ãã¦ãã¾ããä»ãC++20ã§ããC++0xã§é¨ãã§ããé ãæãããã§ãã ä»åã¯æè¿èªåãC++ãæ¸ãæã«æ°ã«ãã¦ãããã¨ã«ã¤ãã¦ç°¡åã«ç´¹ä»ãã¦ãããã¨æãã¾ãã åºæ¬æ¹é åãã³ã¼ãã触ãéçºè ãå¤ããããå®è£ è ã«ã¨ã£ã¦ã®å©ä¾¿æ§ãâ¦
C++ã®algorithmãããã¼ã§å®£è¨ããã¦ããSTLã®ã¢ã«ã´ãªãºã é¢æ°ãã³ãã¬ã¼ãã«ã¯ï¼å¼æ°ã«é¢æ°ãã¤ã³ã¿ãé¢æ°ãªãã¸ã§ã¯ã(ãã¡ã³ã¯ã¿)ãåããã®ãå¤ãï¼ä¾ãã°ï¼å¼æ°ãä¸ã¤ã®é¢æ°ãåãåãstd::transformã¯ä»¥ä¸ã®ã³ã¼ãã¨ç価ã§ããï¼ template <class InputIterator, class OutputIterator, class UnaryOperator> OutputIte</class>â¦
std::boolalphaã使ãï¼ #include <iostream> using namespace std; int main () { bool b = true; cout << boolalpha << b << endl; cout << noboolalpha << b << endl; return 0; } åºåã¯ä»¥ä¸ã®éãï¼ true 1 åèè³æ boolalpha - C++ Reference</iostream>
C++0xã®autoã®ç´¹ä» autoãã¼ã¯ã¼ãã使ã£ã¦å¤æ°ãå®ç¾©ããã¨ï¼ã³ã³ãã¤ã©ãåæåå¤ãåºã«å¤æ°ã®åãæ¨è«ãã¦ãããï¼ int f(); auto x1 = 1; // x1 : int auto x2 = f(); // x2 : int auto x3 = 3.14; // x3 : double auto &x4 = x1; // x4 : int& const auâ¦
C++ã§typenameãã¼ã¯ã¼ãã使ãã±ã¼ã¹ã¯ä»¥ä¸ã®2ã¤ãããï¼ ãã³ãã¬ã¼ããã©ã¡ã¼ã¿ã宣è¨ããã¨ã ãã³ãã¬ã¼ãå ã«ãããã¹ããããä¾åååãæå®ããã¨ã(ä¾å¤ãã) ãã³ãã¬ã¼ããã©ã¡ã¼ã¿ã®å®£è¨æ ã²ã¨ã¤ã¯ãã³ãã¬ã¼ããã©ã¡ã¼ã¿ã宣è¨ããã¨ãï¼ tempâ¦
GCCã®C++0xã®ãµãã¼ãç¶æ³ã¯ä»¥ä¸ã®ãã¼ã¸ã§ç¢ºèªã§ããï¼ http://gcc.gnu.org/projects/cxx0x.htmlãã¡æ©ãC++0xã®æ°æ©è½ã試ãã¦ã¿ããï¼ãã©èå³ã®ããæ©è½ãææ°ã®GCCã§ä½¿ãããã©ããåãããªãï¼ã¨ãã人ã¯ããã§ãã§ãã¯ãã¦ã¿ããï¼åæåãªã¹ãã¨ãauâ¦
Rcppã使ãã¨å¾æ¥ã®æ¹æ³ã¨æ¯ã¹ã¦ããã·ã¼ã ã¬ã¹ã«Rã®æ¡å¼µãä½ããããã«ãªãï¼ Rcpp: Seamless R and C++ Integration RãC++ã§æ¡å¼µããåæ© ä¸»ã«ä»¥ä¸ã®äºç¹ãæããããï¼ è¨ç®é度ãåä¸ããã C++ãã使ããã©ã¤ãã©ãªãRã§å©ç¨ãã 1ã«ã¤ãã¦ã¯ä»¥ä¸ã®è¨â¦
C++ã®ãã³ãã¬ã¼ãã¡ã¿ããã°ã©ãã³ã°ã©ã¤ãã©ãªãBoost.MPLãã«ã¤ãã¦åå¼·ä¸ï¼æ°ãããã®ãåå¼·ããæã¯ã¨ããããããã使ã£ã¦Brainf*ckã®ã¤ã³ã¿ããªã¿ãä½ãã®ãå¦ç¿æ³ã®å®ç³ãªã®ã§ï¼æ©éBoost.MPLã使ã£ã¦Brainf*ckã®ã¤ã³ã¿ããªã¿ãæ¸ããï¼ ã½ã¼ã¹ ã³ã³â¦
C++ãã³ãã¬ã¼ãã¡ã¿ããã°ã©ãã³ã°ã§ãããã試ãã¦ãããè¡ãè©°ã¾ã£ãï¼æååã®å é ã®è¦ç´ (ãç¹å®ã®ä½ç½®ã®è¦ç´ )ãã³ã³ãã¤ã«æã«åå¾ã§ããããã«ãããï¼ä»¥ä¸ã®ããã«ãã³ãã¬ã¼ãå¼æ°ã«æååãå ¥ãããããªå½¢ã§æ¸ãããã®ã ãï¼ã©ãããããã¯ç¡çããâ¦
C++ãã³ãã¬ã¼ããã¯ããã¯ã®2-4ããï¼ #include <iostream> using namespace std; template <class T, int N> int size(T (&x)[N]) { return N; } int main(int argc, char const* argv[]) { int a[] = {1, 2, 3, 4, 5}; cout << size(a) << endl; return 0; } åºåçµæ 5ããã¯é¢ç½ã</class></iostream>â¦
ã¨ããããèªãã§ããããC++æ¬ãåæãã¦ã¿ã(æ¢èªå«ã)ï¼ æ¢èª Effective C++ åè第3ç å®çªï¼C++ã使ãä¸ã§ç¥ã£ã¦ããã¹ã55åã®ã¢ããã¤ã¹ã示ããã¦ããï¼Effective C++ åè第3ç (ADDISON-WESLEY PROFESSIONAL COMPUTING SERIES)ä½è : ã¹ã³ããã»ã¡â¦
ã©ã®åãtypedefãã¦ã©ããBoost.Foreachã«æ¸¡ãã°ããã®ãããåãããªãã£ãã®ã§ã¡ã¢ï¼ #include <iostream> #include <boost/foreach.hpp> #include <boost/bimap/bimap.hpp> #include <boost/bimap/multiset_of.hpp> using namespace std; struct name {}; struct place {}; int main(int argc, char const* argv[]) { using namespace boost</boost/bimap/multiset_of.hpp></boost/bimap/bimap.hpp></boost/foreach.hpp></iostream>â¦
ãããã¼ boost/assign.hpp ã§ããã㨠ã³ã³ããã®åæåã»è¦ç´ 追å ãæ軽ã«ã§ããï¼ ä½¿ç¨ä¾ åæºå #include <boost/assign.hpp> using namespace boost::assign; vector ç°¡åï¼ // åæå vector<int> v = list_of(1)(2)(3); // æ«å°¾ã¸ã®è¦ç´ ã®è¿½å (push_back) v += 4, 5, 6; // v</int></boost/assign.hpp>â¦
ãããã¼ boost/foreach.hpp ã§ããã㨠C++ã§ä»ã®è¨èªã«ãããããªforeachã£ã½ããã¨ãã§ããããã«ãªãï¼ ä½¿ç¨ä¾ BOOST_FOREACHã使ã£ã¦ã³ã³ããã®åè¦ç´ ã«ã¢ã¯ã»ã¹ããå ´åã®ä¾ï¼ std::vector<int> v; v.push_back(1); v.push_back(2); v.push_back(3); BOOST_</int>â¦
C++ã§classãç¶æ¿ãã¦ä»®æ³é¢æ°ããªã¼ãã¼ã©ã¤ãããéã«ï¼ãã®ä»®æ³é¢æ°ã®ããã©ã«ãå¼æ°ãå¤æ´ãã¦ã¯ãªããªãï¼ã¨ãã話ã§ãï¼ãã®è©±ã¯Exceptional C++ã®é ç®21ã«è¼ã£ã¦ãã¾ãï¼ åé¡ ä»¥ä¸ã®ã³ã¼ãã®å®è¡çµæãäºæ³ãã¦ã¿ã¦ãã ããï¼ #include <iostream> using names</iostream>â¦
ãããã¡ãã£ã¨çºãã¦ã¿ã¦æä½éææ¡ãã¦ãããã¨æã£ããã®ãåæï¼æ¢ã«ææ¡ãã¦ãããã®ãå«ãï¼ æåå format lexical_cast regex, xpressive spirit string_algo tokenizer ã¹ãã¼ããã¤ã³ã¿ shared_ptr weak_ptr å ¥åºå filesystem ã¹ã¬ãã thread æ°â¦
C++ STLã®setãmapã®å ´åã¯è¦ç´ ãå°ããé ã«ã½ã¼ããããã©ï¼priority_queueã¯è¦ç´ ã大ããé ã«ä¸¦ã¹ãï¼priority_queueã®å®ç¾©ã¯ãããªæãï¼ template <class T, class Container = vector<T>, class Compare = less<typename Container::value_type> > class priority_queue; ããã§ç´ããããã®ã¯ï¼Compareã«ã¯ããã©ã«ãã§lessã</typename></class>â¦
æå°å ¨åæ¨åé¡ã解ãããã®ã¢ã«ã´ãªãºã ãã¯ã©ã¹ã«ã«æ³ãã¨ãããªã æ³ãã使ã£ã¦ã¿ãï¼ æå°å ¨åæ¨ã«ã¤ã㦠ã¯ã©ã¹ã«ã«æ³ ããªã æ³ PKUã®åé¡ ã¯ã©ã¹ã«ã«æ³ã«ãã解ç ããªã æ³ã«ãã解ç ã¡ã¢ãªä½¿ç¨éã¨å®è¡æéã®æ¯è¼
ã¾ãPKUã®åé¡ã解ãã¦ã¿ãï¼ä»åã®ãã¼ãã¯Union Findï¼ Union Find Disjoint Sets(äºãã«ç´ ãªéå)ã«ãããUnion Findã¨ã¯ï¼æå®ãããäºã¤ã®è¦ç´ xï¼yãåãéåã«å«ã¾ãããã©ããã調ã¹ãã¢ã«ã´ãªãºã ã®ãã¨ï¼éåã¨è¦ç´ ãå¤åæ¨ã¨ãã®èã§è¡¨ç¾ãï¼æ¨ã®â¦
ä¹ ãæ¯ãã«PKU JudgeOnlineã®åé¡ãC++ã§è§£ãã¦ã¿ãï¼ä»æ¥è§£ããã®ã¯ä»¥ä¸ã®æ¯è¼çç°¡åã¨æããã4é¡ï¼ Problem 1915 - Knight Moves http://acm.pku.edu.cn/JudgeOnline/problem?id=1915 Problem 1917 - Automatic Poetry http://acm.pku.edu.cn/JudgeOnlineâ¦
åºåºã¯ã©ã¹ã®ãªãã¡ã¬ã³ã¹ã§æ´¾çã¯ã©ã¹ã®ãªãã¸ã§ã¯ããæããå ´åã§ãã¡ããã¨æ´¾çã¯ã©ã¹ã§ãªã¼ãã¼ã©ã¤ãããã¡ã³ãé¢æ°ãå¼ã³åºããã¿ããï¼ã¸ãã¼ã¸ãã¼ã¸ãã¼ï¼ #include <iostream> using namespace std; class Base { public: virtual void message() { cout <<</iostream>â¦
id:syou6162ã¨Skypeãã£ãããã¦ããæã«ã«ãã«ãããªããæ¸ããï¼ #include <iostream> using namespace std; class Base { public: virtual void message() { cout << "Base" << endl; } }; class Inherit : public Base { public: void message() { cout << "Inheri</iostream>â¦
ããã°ã©ã ã®ä¿®æ£ã»å®è¡ãç¹°ãè¿ãã¦ããã¨ãã«ããã2ã¶æã®ã³ã¼ãã®ã³ã¡ã³ãã¢ã¦ããåãæ¿ããããªãæããã¾ã«ãã£ããããããããªã¨ãã«å½¹ç«ã¤å°æã âã®ãããªæãã§ãã³ã¡ã³ãã¢ã¦ãã®åãæ¿ããè¡ãããã³ã¼ãã//*ã¨/*/ã¨//*/ã®3è¡ã§ã¯ããã #incâ¦
C++ã§åç½®ã»å¾ç½®ã¤ã³ã¯ãªã¡ã³ã/ãã¯ãªã¡ã³ãæ¼ç®åããªã¼ãã¼ãã¼ããã
ãªã¼ãã¼ãã¼ãã®ããæ¹èªä½ã¯ä»ã®æ¼ç®åã¨åãã ãã©ãåç½®ã¨å¾ç½®ã§ã©ã®ããã«å®ç¾©ãæ¸ãåããã°ããã®ãç¥ããªãã£ãã®ã§èª¿ã¹ã¦ã¿ãã åç½®ã¨å¾ç½®ã®éã åç½®ã¤ã³ã¯ãªã¡ã³ã/ãã¯ãªã¡ã³ã æ»ãå¤ã¯*thisã¸ã®ãªãã¡ã¬ã³ã¹ã«ãã ++(++t)ã®ããã«ãæ»ãå¤ãâ¦
ãã ãmã¯æ´æ°ãnã¯éè² ã®æ´æ°ã ãããªæãã§ããã°O(log n)ã§m^nãè¨ç®ã§ããã #include <iostream> using namespace std; int pow(int m, int n) { if (n == 0) { return 1; } if (n % 2 == 0) { return pow(m*m, n/2); } return pow(m, n-1) * m; } int main() { </iostream>â¦