Not your computer? Use a private browsing window to sign in. Learn more about using Guest mode
typedef enum memory_order { memory_order_relaxed, memory_order_consume, memory_order_acquire, memory_order_release, memory_order_acq_rel, memory_order_seq_cst } memory_order; enum class memory_order : /* unspecified */ { relaxed, consume, acquire, release, acq_rel, seq_cst }; inline constexpr memory_order memory_order_relaxed = memory_order::relaxed; inline constexpr memory_order memory_order_cons
c++ã®stringã¯ã©ã¹ã¨æååãã¤ã³ã¿ã®é¢ä¿ã«ã¤ãã¦èª¿ã¹ã¦ããããã§ããï¼ #include <iostream> using namespace std; class Color { string color; public: Color(string a) { cout<<"Color"<<endl; color = a; } void echo() { cout<<color<<endl; } ~Color() { } }; int main(int argc, char *argv[]){ Color c(string(argv[1])); c.echo(); return(0); }ãããªããã°ã©ã ã§ï¼å¼æ°ã§ä¸ããæååã表示ãããã®ãæå¾ ãã¾ããï¼ã¨ããã $ c++ test.cc test.cc: In function 'int main(int, char**)':
C++11 ã«ã¯ãè¤æ°ã® Lockable ãªãªãã¸ã§ã¯ããããã¯ãã¦ããã std::lock é¢æ°ãããã¾ãã template<class L1, class L2, class... L3> void lock(L1& m1, L2& m2, L3&... m3); ãã®é¢æ°ã®æ大ã®ç¹å¾´ã¯ã決ãã¦ãããããã¯ããªããã¨ã§ãã ããã¦ããã®ãããããã¯ããªãã¨ããè¦ä»¶ãæºããããã«ä½¿ãããã¢ã«ã´ãªãºã ããtry-and-back-off ã¢ã«ã´ãªãºã ã¨å¼ã°ãããã®ã§ãã ä»åã¯ãã® try-and-back-off ã¢ã«ã´ãªãºã ã«ã¤ãã¦èª¬æãã¾ãã ï¼ãã®è¨äºã«ã¯ç¬èªè§£éãå«ã¾ãã¦ããã®ã§ãééã£ã¦ãé¨åã¨ãããã°ææãã¦é ããã¨å¬ããã§ãï¼ ãããããã¯ã®æ¡ä»¶ ãããããã¯ã¯ãæ£ç¢ºã§ã¯ãªãã§ããã大ã¾ãã«è¨ã£ã¦ä»¥ä¸ã®æ¡ä»¶ãæºããã¨çºçãã¾ãã ããã¯ãåå¾ããããã«å¾ æ©ãè¡ãªã ã
ä¸è¨ã®æ§ã«ããã¼ã¯ã³ã¯åèå¥æ¯ã«ä½ããã¾ãããªãã¸ã§ã¯ãã®ãã¼ããã³å¤ãããããã®ãã¼ã¯ã³ã¨ãã¦æ ¼ç´ããã¾ãã jsmn_parse ã¯ãã¼ã¯ã³ã®éãä¸è¶³ãã¦ããå ´åãã¨ã©ã¼ JSMN_ERROR_NOMEM ãè¿ãã¾ããä¾ãã°ãã©ãã ãã®éã®ãã¼ã¯ã³ã JSON æååã¨ãã¦ä¸ãããããåãããªãå ´åããã¼ã¯ã³ã®ãµã¤ãºãåºããå¿ è¦ãããã¾ãããã®å ´åãjsmn ã§ã¯ãã¼ãµãååæåããäºãªãã«ããã¼ã¯ã³ãåºãã¦å度 jsmn_parse ãå®è¡ããäºã§ãã¼ã¹ãç¶è¡åºæ¥ãæ§ã«ãªã£ã¦ãã¾ãã ãã ãã©ãã ãã®éãä¸è¶³ãã¦ãããã¯åãããªãã®ã§ãé©åº¦ãªå¢æ¸ãèæ ®ããå¿ è¦ãããã¾ãã ä»æ¥ã¯è©¦ãã« twitter ã®ãããªãã¯ã¿ã¤ã ã©ã¤ã³ããã¼ã¹ãã¦ã¿ã¾ããã #include <assert.h> #include <string.h> #include <memory.h> #include
Code Style No.7 ããããã¼ã¸ãã¼ã¸ä¸è¦§ã¡ã³ãã¼ç·¨é Lemon Parser Generator - Practice æçµæ´æ°ï¼ csn7 2011å¹´03æ07æ¥(æ) 18:28:35å±¥æ´ Tweet Lemon Parser GeneratorãçæããCã³ã¼ããããããªã³ãªã¼ã®ãã¼ãµã¨ãã¦æä¾ããã«ã¯ã©ããããè¯ããã®ã¾ã¨ããLemonèªä½ã¨ãã³ãã¬ã¼ãã«ã¯æãå ããªãç¸ãããªããä¾é¡ã¯ååæ¼ç®ã§ãBoost.Variantãçæããï¼ã¹ãã£ãã¯ãªãï¼ã é¢é£è¨äºã¯ä¸è¨ã Boost.Variant - recursive (4) Header Only Lemon (1) Header Only Lemon (2) Lemon - malloc and realloc ã¾ãã¯ææ³ãã¡ã¤ã«ã %token_prefix MORLA_EXAMPLE_PARSER_ %
caperã¨ã¯ modernã§ã¯ãªã¼ã³ãªC++ã³ã¼ããåºåããLALR(1)ãã¼ãµã¸ã§ãã¬ã¼ã¿ã§ãã ãã¾ãã§JavaScript/C#/Dç¨ã®ãã¼ãµãåºåã§ãã¾ãã ãã¥ã¼ã¹ã»å±¥æ´ã¯ãã¦ã³ãã¼ãã®ãã¼ã¸ã§ã ã³ã³ã»ãã caperã§åºåãããã¼ãµã®ã³ã¼ããä»ã®ããã¸ã§ã¯ãã¨æ··ãã¦ãææ¸ãã®ãã¼ãµã§ãããªã«ãï¼ã ã¨å¼·å¼ã§ããã®ãçæ³ã æ ¼éã²ã¼ã ã®ã³ãã³ã解æã«ä½¿ããããã使ããããï¼ ãã¨ãã°ï¼ ãããªæãã®å ¥åãã¡ã¤ã«ã %token Number<int> Add Sub Mul Div; %namespace calc; %dont_use_stl; Expr<int> : [Identity] Term(0) | [MakeAdd] Expr(0) Add Term(1) | [MakeSub] Expr(0) Sub Term(1) ; Term<int> : [Identi
å½¢æ ç´ ã®é »åº¦ãã«ã¦ã³ãããã¨ããã·ã³ãã«ãªã¿ã¹ã¯ã§ std::tr1::unordered_map ã®æ§è½ã«ã¤ãã¦å®é¨ãã¦ã¿ã¾ããï¼std::string ãã const char * ã®æ¹ãã¡ã¢ãªãç¯ç´ã§ããã¨ãããããªè»½ãå 容ã§ãï¼ å®é¨æ¦è¦ å®é¨ç°å¢ã¯ä»¥ä¸ã®ã¨ããã§ãï¼ å®é¨ç°å¢ CPUï¼Core 2 Duo U9600 1.60GHz ã³ã³ãã¤ã©ï¼gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) å ¥åã¨ãã¦ä½¿ç¨ããã®ã¯ï¼ã¦ã§ãã³ã¼ãã¹ããæ½åºããå½¢æ ç´ ãæ¹è¡åºåãã§ä¿åãããã¡ã¤ã«ã§ãï¼ å ¥å ãµã¤ãºï¼815,793,701 bytes å½¢æ ç´ æ°ï¼133,940,786 ç°ãªãæ°ï¼516,612 å½¢æ ç´ ã®å ¥åã«ã¤ãã¦ã¯ï¼std::ios::sync_with_stdio(false) ãå¼ã³åºããå¾ã§ std::getline() ã使ãããã«ã
æ¹å¼cã®æ¹è¯ã§ããã¾ãããåæåé ãã®åé¡ãé¿ããããã«ã¯ãã³ã³ã¹ãã©ã¯ã¿ãå¼ã³åºããã¨ãªãåæåãæ¸ãã§ãããªãã¸ã§ã¯ãã§ãªããã°ãªãã¾ããããã®ããã«ã¯ãmutexãªãã¸ã§ã¯ãã // æ¹æ³c' (ä»®) void Foo::need_to_sync(void) { static StaticMutex mutex = { PTHREAD_MUTEX_RECURSIVE_INITIALIZER_NP, ........ };ã®ããã«åæåã§ããªããã°ãªãã¾ãããä¸è¬çãªC++ã®ã¯ã©ã¹ã¯ããããå½¢ã®åæåã¯è¨±ããã¾ããããã®ãããªåæåãå®ç¾ããããã«ã¯ãä¸è¨StaticMutexã¯ã©ã¹ã¯PODåã§ãªããã°ãªãã¾ãããPODåã¨ããã®ã¯ãè¦æ ¼ã«ãã㨠ã³ã³ã¹ãã©ã¯ã¿ããã£ã¦ã¯ãã¡ ãã¹ãã©ã¯ã¿ããã£ã¦ã¯ãã¡ ã³ãã¼ã³ã³ã¹ãã©ã¯ã¿ãä»£å ¥æ¼ç®åã¯ã³ã³ãã¤ã©ãçæããªãã¨ãã¡ private,
mutexã¯ã¹ã¬ããéã®æä»å¦çãããããã®æ©æ§ã ãï¼ä¸è¬çãªthreadã©ã¤ãã©ãªã®ããã©ã«ãã®mutexã«ã¯å¤§ããªåé¡ãããï¼ããmutexãæ¢ã«lockãã¦ããthreadãå度åãmutexãlockãããã¨ããã¨ãããã¯ãã¦ãã¾ãã®ã ï¼ãã¨ãã°ï¼thread bufferã®ä¾ã§ï¼emptyãå¤å®ããé¨åãå¥ã¡ã½ããã«ãã¦ï¼ãã¡ããlockããããããã«æ¸ãç´ãã¦ã¿ãï¼ class buffer { list<int> queue; boost::condition_variable cond; boost::mutex mut; public: bool empty() { boost::lock_guard<boost::recursive_mutex> lock(mut); return queue.empty(); } ... int pop() throw(out_of_
yacc ã lex ãã¤ãã£ã¦ãã¦ãããªãããããããããã©ããããã¨ããç¶æ ã«ãªããã¡ã ã£ãããã°ãã¼ãã«å¤æ°ã«ã¾ã¿ãããããã¡ã ããre2c + lemon ã ã¨ãã®ã¸ãããã£ããããã ã¬ããµã以ä¸ã®ããã«ãããyyfill ãèªåã§ãããªããã°ãããªãã®ãã¡ãã£ã¨é¢åã ãããã®ãããªã¯ã©ã¹ãæ軽ã«ãããã®ã¯ãã¯ã便å©ã§ãããflex ã§ã¯ããã¯ãããªãã®ã ã #ifndef CALC_SCANNER_H_ #define CALC_SCANNER_H_ #include <stdio.h> #include <string.h> #include <string> #include <sstream> #include <vector> #include <iostream> #include <fstream> #include "scanner.def.h" #include
This is an example of simple usage. // include cmdline.h #include "cmdline.h" int main(int argc, char *argv[]) { // create a parser cmdline::parser a; // add specified type of variable. // 1st argument is long name // 2nd argument is short name (no short name if '\0' specified) // 3rd argument is description // 4th argument is mandatory (optional. default is false) // 5th argument is default value
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}