├── In-depth_C++11
├── ch01-moderner_and_simpler
│ ├── .cc
│ ├── 1-11_1-15_for_range
│ │ └── Test.cc
│ ├── 1-06_》.cc
│ ├── 1-03_decltype.cc
│ ├── 1-08_init.cc
│ ├── 1-07_init.cc
│ ├── 1-02_auto.cc
│ ├── 1-19.cc
│ ├── 1-10_init_narrow.cc
│ ├── 1-05_template.cc
│ ├── 1-24.cc
│ ├── 1-22.cc
│ ├── 1-21.cc
│ ├── 1-17_std_function.cc
│ ├── 1-09_init.cc
│ ├── 1-20.cc
│ ├── 1-16_functor.cc
│ ├── Makefile
│ ├── 1-04_decltype.cc
│ └── 1-23.cc
├── ch08-Pattern
│ ├── 8-3
│ ├── 8-5
│ ├── NonCopyable.hpp
│ ├── Visitor.hpp
│ ├── Makefile
│ ├── 8-5.cc
│ ├── 8-3.cc
│ └── Command.hpp
├── ch04-smart-pointer
│ ├── 4-1
│ └── Makefile
├── ch05-thread
│ ├── 5-1
│ │ ├── 5-1.v12.suo
│ │ └── 5-1
│ │ │ └── Test.cpp
│ ├── 5-2
│ │ ├── 5-2.v12.suo
│ │ └── 5-2
│ │ │ └── Test.cpp
│ ├── 5-3
│ │ ├── 5-3.v12.suo
│ │ └── 5-3
│ │ │ └── Test.cpp
│ ├── 5-4
│ │ └── 5-4.v12.suo
│ ├── 5-5
│ │ ├── 5-5.v12.suo
│ │ └── 5-5
│ │ │ ├── SyncQueue.hpp
│ │ │ └── Test.cpp
│ ├── 5-6
│ │ ├── 5-6.v12.suo
│ │ └── 5-6
│ │ │ └── Test.cpp
│ ├── 5-7
│ │ ├── 5-7.v12.suo
│ │ └── 5-7
│ │ │ └── Test.cpp
│ ├── 5-8
│ │ ├── 5-8.v12.suo
│ │ └── 5-8
│ │ │ └── Test.cpp
│ ├── 5-9
│ │ ├── 5-9.v12.suo
│ │ └── 5-9
│ │ │ └── Test.cpp
│ └── 5-10
│ │ └── 5-10.v12.suo
├── ch06-chrono_and_convert
│ ├── 6-1
│ ├── 6-2
│ ├── 6.1
│ │ ├── Timer.hpp
│ │ └── Test.cc
│ ├── Makefile
│ └── 6-3.cc
├── ch03-type_traits_and_vargs
│ ├── 3-3
│ │ └── 3-3.v12.suo
│ ├── 3-4
│ │ └── 3-4.v12.suo
│ ├── 3-5
│ │ ├── 3-5.v12.suo
│ │ └── 3-5
│ │ │ ├── Test.cpp
│ │ │ └── optional.hpp
│ ├── 3-9
│ │ ├── 3-9.v12.suo
│ │ └── 3-9
│ │ │ ├── MyDLL.dll
│ │ │ ├── MyDLL.lib
│ │ │ ├── MyDLL.h
│ │ │ └── Test.cpp
│ ├── 3-10
│ │ ├── 3-10.v12.suo
│ │ └── 3-10
│ │ │ ├── MyDLL.dll
│ │ │ └── Test.cpp
│ ├── 3-12
│ │ └── 3-12.v12.suo
│ ├── 3-13
│ │ ├── 3-13.v12.suo
│ │ └── 3-13
│ │ │ ├── Any.hpp
│ │ │ └── 源.cpp
│ ├── 3-14
│ │ ├── 3-14.v12.suo
│ │ └── 3-14
│ │ │ └── Test.cpp
│ ├── 3-15
│ │ ├── 3-15.v12.suo
│ │ └── 3-15
│ │ │ ├── Test.cpp
│ │ │ └── Variant.hpp
│ ├── 3-17
│ │ ├── 3-17.v12.suo
│ │ └── 3-17
│ │ │ └── Test.cpp
│ ├── 3-18
│ │ └── 3-18.v12.suo
│ ├── 3-19
│ │ ├── 3-19.v11.suo
│ │ ├── 3-19.v12.suo
│ │ └── 3-19
│ │ │ └── Test.cpp
│ ├── 3-20
│ │ ├── 3-20.v12.suo
│ │ └── 3-20
│ │ │ └── Test.cpp
│ ├── 3-21
│ │ ├── 3-21.v12.suo
│ │ └── 3-21
│ │ │ └── Test.cpp
│ ├── 3-22
│ │ ├── 3-22.v12.suo
│ │ └── 3-22
│ │ │ ├── TpIndexs.hpp
│ │ │ └── Test.cpp
│ ├── 3-23
│ │ ├── 3-23.v12.suo
│ │ └── 3-23
│ │ │ └── Test.cpp
│ ├── 3-24
│ │ ├── 3-24.v12.suo
│ │ └── 3-24
│ │ │ └── Test.cpp
│ ├── 3-25
│ │ ├── 3-25.v12.suo
│ │ └── 3-25
│ │ │ ├── TpZip.hpp
│ │ │ └── Test.cpp
│ ├── 3-7~3-8
│ │ ├── 3-7~3-8.v12.suo
│ │ └── 3-7~3-8
│ │ │ └── Test.cpp
│ ├── Makefile
│ ├── 3-1.cc
│ ├── enable_if.cc
│ └── 3.16
│ │ └── Test.cc
└── ch02-rvalue
│ └── Makefile
├── Fluent_Python
├── ch11-iface-abc
│ ├── tombola_class
│ │ ├── __init__.py
│ │ ├── __pycache__
│ │ │ ├── bingo.cpython-36.pyc
│ │ │ ├── drum.cpython-36.pyc
│ │ │ ├── lotto.cpython-36.pyc
│ │ │ ├── __init__.cpython-36.pyc
│ │ │ ├── tombola.cpython-36.pyc
│ │ │ └── tombolist.cpython-36.pyc
│ │ ├── drum.py
│ │ ├── tombolist.py
│ │ ├── bingo.py
│ │ └── lotto.py
│ └── frenchdeck_class
│ │ └── frenchdeck2.py
├── ch14-it-generator
│ ├── isis2json
│ │ ├── cds2.json
│ │ ├── cds.iso
│ │ └── cds.mst
│ ├── aritprog
│ │ ├── class
│ │ │ ├── __pycache__
│ │ │ │ ├── aritprog_v0.cpython-36.pyc
│ │ │ │ ├── aritprog_v1.cpython-36.pyc
│ │ │ │ ├── aritprog_v2.cpython-36.pyc
│ │ │ │ └── aritprog_v3.cpython-36.pyc
│ │ │ ├── aritprog_v3.py
│ │ │ └── aritprog_v0.py
│ │ └── aritprog_float_error.py
│ ├── sentence
│ │ └── class
│ │ │ ├── __pycache__
│ │ │ ├── sentence_gen.cpython-36.pyc
│ │ │ ├── sentence_gen2.cpython-36.pyc
│ │ │ ├── sentence_iter.cpython-36.pyc
│ │ │ ├── sentence_iter2.cpython-36.pyc
│ │ │ ├── sentence_genexp.cpython-36.pyc
│ │ │ └── sentence_getitem.cpython-36.pyc
│ │ │ ├── sentence_gen2.py
│ │ │ ├── sentence_gen.py
│ │ │ ├── sentence_getitem.py
│ │ │ └── sentence_iter2.py
│ └── soapbox
│ │ └── yield_delegate
│ │ └── yield_delegate_fix.py
├── ch18-asyncio
│ ├── charfinder
│ │ ├── requirements.txt
│ │ └── http_charfinder.html
│ └── flags
│ │ └── downloads
│ │ ├── bd.gif
│ │ ├── br.gif
│ │ ├── cd.gif
│ │ ├── cn.gif
│ │ ├── de.gif
│ │ ├── eg.gif
│ │ ├── et.gif
│ │ ├── fr.gif
│ │ ├── id.gif
│ │ ├── in.gif
│ │ ├── ir.gif
│ │ ├── jp.gif
│ │ ├── mx.gif
│ │ ├── ng.gif
│ │ ├── ph.gif
│ │ ├── pk.gif
│ │ ├── ru.gif
│ │ ├── tr.gif
│ │ ├── us.gif
│ │ └── vn.gif
├── ch17-futures
│ ├── flags
│ │ ├── downloads
│ │ │ ├── bd.gif
│ │ │ ├── br.gif
│ │ │ ├── cd.gif
│ │ │ ├── cn.gif
│ │ │ ├── de.gif
│ │ │ ├── eg.gif
│ │ │ ├── et.gif
│ │ │ ├── fr.gif
│ │ │ ├── id.gif
│ │ │ ├── in.gif
│ │ │ ├── ir.gif
│ │ │ ├── jp.gif
│ │ │ ├── mx.gif
│ │ │ ├── ng.gif
│ │ │ ├── ph.gif
│ │ │ ├── pk.gif
│ │ │ ├── ru.gif
│ │ │ ├── tr.gif
│ │ │ ├── us.gif
│ │ │ └── vn.gif
│ │ ├── __pycache__
│ │ │ └── flags.cpython-36.pyc
│ │ └── flags_threadpool.py
│ └── flags2
│ │ ├── downloads
│ │ ├── bd.gif
│ │ ├── br.gif
│ │ ├── cd.gif
│ │ ├── cn.gif
│ │ ├── de.gif
│ │ ├── eg.gif
│ │ ├── et.gif
│ │ ├── fr.gif
│ │ ├── id.gif
│ │ ├── in.gif
│ │ ├── ir.gif
│ │ ├── jp.gif
│ │ ├── mx.gif
│ │ ├── ng.gif
│ │ ├── ph.gif
│ │ ├── pk.gif
│ │ ├── ru.gif
│ │ ├── tr.gif
│ │ ├── us.gif
│ │ └── vn.gif
│ │ └── __pycache__
│ │ ├── flags2_common.cpython-36.pyc
│ │ └── flags2_sequential.cpython-36.pyc
├── ch19-dyn-attr-prop
│ ├── oscon
│ │ ├── __pycache__
│ │ │ └── osconfeed.cpython-36.pyc
│ │ ├── demo_schedule2.py
│ │ └── test_schedule1.py
│ ├── pseudo_construction.py
│ └── doc_property.py
├── ch04-text-byte
│ ├── README.rst
│ ├── default_encodings.py
│ ├── ramanujan.py
│ └── numerics_demo.py
├── ch18b-async-await
│ ├── charfinder
│ │ ├── __pycache__
│ │ │ └── charfinder.cpython-36.pyc
│ │ └── http_charfinder.html
│ ├── flags
│ │ └── imported
│ │ │ └── __pycache__
│ │ │ ├── flags.cpython-36.pyc
│ │ │ └── flags2_common.cpython-36.pyc
│ └── README.rst
├── ch07-deco-closure
│ ├── README.rst
│ ├── clockdeco
│ │ ├── clock_param
│ │ │ ├── __pycache__
│ │ │ │ └── clockdeco_param.cpython-36.pyc
│ │ │ ├── clockdeco_param_demo1.py
│ │ │ └── clockdeco_param_demo2.py
│ │ └── clockdeco
│ │ │ ├── fibo_demo.py
│ │ │ ├── fibo_demo_lru.py
│ │ │ ├── clockdeco.py
│ │ │ └── clockdeco_demo.py
│ ├── fibo_demo.py
│ ├── fibo_demo_lru.py
│ ├── registration_abridged.py
│ ├── average
│ │ ├── average_oo.py
│ │ └── average.py
│ ├── registration.py
│ └── registration_param.py
├── ch21-class-metaprog
│ ├── README.rst
│ └── evalsupport.py
├── ch10-seq-hacking
│ └── README.rst
├── ch02-array-seq
│ ├── genexps.py
│ └── cartesian.py
├── ch16-coroutine
│ ├── c_impl
│ │ ├── coro.h
│ │ ├── main.cc
│ │ └── Makefile
│ └── coroaverager
│ │ └── coroaverager1-prime
│ │ ├── coroutil.py
│ │ └── coroaverager1.py
├── ch05-1class-func
│ ├── factorial.py
│ ├── functor.py
│ └── bingocall.py
├── ch06-dp-1class-func
│ ├── README.rst
│ ├── strategy_func
│ │ └── c++_version
│ │ │ └── Makefile
│ └── strategy_best
│ │ └── promotions.py
├── ch20-descriptor
│ └── bulkfood
│ │ └── model_v4c.py
├── ch13-op-overloading
│ └── bingo_addable
│ │ └── bingo.py
├── ch01-data-model
│ └── vec.py
├── ch12-inheritance
│ └── diamond.py
├── ch09-pythonic-obj
│ └── mem_test.py
└── ch03-dict-set
│ └── dialcodes.py
├── Effective_Modern_Cpp
├── Item22-Pimp_Idiom
│ ├── gadget.h
│ ├── c++98
│ │ ├── gadget.h
│ │ ├── code.cc
│ │ ├── widget.h
│ │ ├── Makefile
│ │ └── widget.cc
│ ├── code.cc
│ ├── Makefile
│ ├── widget.cc
│ └── widget.h
├── Item19-shared_ptr
│ ├── shared_ptr.png
│ └── Makefile
├── Item29-move-failure
│ ├── arr_move.png
│ ├── vec_move.png
│ ├── code.cc
│ └── Makefile
├── Item40-atomic_volatile@std
│ ├── code
│ └── Makefile
├── README.md
├── Item07-initializer
│ └── Makefile
├── Item12-override
│ └── Makefile
├── Item37-unjoinable
│ └── Makefile
├── Item41-always_copy
│ └── Makefile
├── Item42-emplace_back
│ └── Makefile
├── Item01-template_deduction
│ └── Makefile
├── Item02-auto_deduction
│ └── Makefile
├── Item03-decltype
│ └── Makefile
├── Item05-use_auto
│ └── Makefile
├── Item08-nullptr
│ └── Makefile
├── Item10-scoped_enum
│ └── Makefile
├── Item11-deleted
│ └── Makefile
├── Item14-noexcept
│ └── Makefile
├── Item15-constexpr
│ └── Makefile
├── Item20-weak_ptr
│ └── Makefile
├── Item30-imperfect_forward
│ └── Makefile
├── Item32-use_init_capture
│ └── Makefile
├── Item33-universal_auto_in_lambda
│ ├── code.cc
│ └── Makefile
├── Item06-not_use_auto
│ └── Makefile
├── Item23-move_forward
│ └── Makefile
├── Item31-avoid_default_capture
│ └── Makefile
├── Item34-prefer_lambda_to_bind
│ └── Makefile
├── Item35-prefer_task_to_thread
│ ├── Makefile
│ └── code.cc
├── Item04-check_deduced_type
│ ├── Makefile
│ └── code.cc
├── Item09-using_vs_typedef
│ └── Makefile
├── Item38-varying_thread_destructor
│ └── Makefile
├── Item16-make_const_thread_safe
│ └── Makefile
├── Item24-universal_reference
│ └── Makefile
├── Item28-reference_collapsing
│ └── Makefile
├── Item36-async_if_asynchronicity@launch@std
│ └── Makefile
├── Item21-make_shared_make_uniqure
│ └── Makefile
├── Item26-avoid_overload@universal
│ └── Makefile
├── Item25-move@rvalue_forward@universal
│ └── Makefile
├── Item27-alternatives_to_overload@universal
│ └── Makefile
├── Item18-unique_ptr
│ └── Makefile
├── Item13-const_iterator
│ └── Makefile
├── Item17-autogen_member_functions
│ └── Makefile
└── Item39-void_futures
│ └── Makefile
├── Muduo_ChenShuo
├── ch06_sudoku
│ ├── req.txt
│ ├── sudoku.h
│ ├── README
│ └── build.sh
├── ch08_reactor
│ ├── s00_EventLoop
│ │ ├── test2.cc
│ │ ├── Makefile
│ │ ├── test1.cc
│ │ └── EventLoop.h
│ ├── s13_epoll
│ │ ├── test2.cc
│ │ ├── Timer.cc
│ │ ├── test12.cc
│ │ ├── test1.cc
│ │ ├── test6.cc
│ │ ├── test7.cc
│ │ ├── TimerId.h
│ │ ├── test3.cc
│ │ └── EventLoopThread.h
│ ├── s01_timerfd
│ │ ├── Makefile
│ │ └── test3.cc
│ ├── Makefile
│ ├── s08_send
│ │ ├── Timer.cc
│ │ ├── Makefile
│ │ ├── TimerId.h
│ │ └── EventLoopThread.h
│ ├── s02_TimerQueue
│ │ ├── Timer.cc
│ │ ├── Makefile
│ │ ├── Callbacks.h
│ │ └── TimerId.h
│ ├── s03_runInLoop
│ │ ├── Timer.cc
│ │ ├── Callbacks.h
│ │ ├── Makefile
│ │ ├── TimerId.h
│ │ └── EventLoopThread.h
│ ├── s04_Acceptor
│ │ ├── Timer.cc
│ │ ├── Makefile
│ │ ├── Callbacks.h
│ │ ├── test7.cc
│ │ ├── TimerId.h
│ │ └── EventLoopThread.h
│ ├── s07_Buffer
│ │ ├── Timer.cc
│ │ ├── Makefile
│ │ ├── TimerId.h
│ │ ├── test3.cc
│ │ └── EventLoopThread.h
│ ├── s09_SIGPIPE
│ │ ├── Timer.cc
│ │ ├── Makefile
│ │ ├── TimerId.h
│ │ └── EventLoopThread.h
│ ├── s05_TcpConnection
│ │ ├── Timer.cc
│ │ ├── Makefile
│ │ ├── TimerId.h
│ │ └── EventLoopThread.h
│ ├── s06_TcpConnection
│ │ ├── Timer.cc
│ │ ├── Makefile
│ │ ├── TimerId.h
│ │ └── EventLoopThread.h
│ ├── s10_multithread
│ │ ├── Timer.cc
│ │ ├── Makefile
│ │ └── TimerId.h
│ ├── s11_Connector
│ │ ├── Timer.cc
│ │ ├── test12.cc
│ │ ├── Makefile
│ │ ├── TimerId.h
│ │ └── EventLoopThread.h
│ ├── s12_TcpClient
│ │ ├── Timer.cc
│ │ ├── Makefile
│ │ ├── TimerId.h
│ │ └── EventLoopThread.h
│ └── mkdiff.sh
└── Makefile
├── README.md
└── Using_STL
├── data
├── fibonacci.txt
├── temperatures.txt
└── Renewables_vs_kwh_cost.txt
├── Checkout
├── main.cc
├── Checkout_up
│ ├── Makefile
│ └── Customer.h
├── Checkout_object
│ └── Customer.h
└── customer.h
├── Makefile
└── .vscode
└── tasks.json
/In-depth_C++11/ch01-moderner_and_simpler/.cc:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Fluent_Python/ch11-iface-abc/tombola_class/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Fluent_Python/ch14-it-generator/isis2json/cds2.json:
--------------------------------------------------------------------------------
1 | { "docs" :
--------------------------------------------------------------------------------
/Fluent_Python/ch18-asyncio/charfinder/requirements.txt:
--------------------------------------------------------------------------------
1 | aiohttp==0.13.1
2 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item22-Pimp_Idiom/gadget.h:
--------------------------------------------------------------------------------
1 | //自定义类型的定义
2 | typedef int Gadget;
3 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item22-Pimp_Idiom/c++98/gadget.h:
--------------------------------------------------------------------------------
1 | //自定义类型的定义
2 | typedef int Gadget;
3 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch06_sudoku/req.txt:
--------------------------------------------------------------------------------
1 | 000000010400000000020000000000050407008000300001090000300400200050100000000806000
2 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch08-Pattern/8-3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch08-Pattern/8-3
--------------------------------------------------------------------------------
/In-depth_C++11/ch08-Pattern/8-5:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch08-Pattern/8-5
--------------------------------------------------------------------------------
/In-depth_C++11/ch04-smart-pointer/4-1:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch04-smart-pointer/4-1
--------------------------------------------------------------------------------
/In-depth_C++11/ch05-thread/5-1/5-1.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch05-thread/5-1/5-1.v12.suo
--------------------------------------------------------------------------------
/In-depth_C++11/ch05-thread/5-2/5-2.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch05-thread/5-2/5-2.v12.suo
--------------------------------------------------------------------------------
/In-depth_C++11/ch05-thread/5-3/5-3.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch05-thread/5-3/5-3.v12.suo
--------------------------------------------------------------------------------
/In-depth_C++11/ch05-thread/5-3/5-3/Test.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch05-thread/5-3/5-3/Test.cpp
--------------------------------------------------------------------------------
/In-depth_C++11/ch05-thread/5-4/5-4.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch05-thread/5-4/5-4.v12.suo
--------------------------------------------------------------------------------
/In-depth_C++11/ch05-thread/5-5/5-5.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch05-thread/5-5/5-5.v12.suo
--------------------------------------------------------------------------------
/In-depth_C++11/ch05-thread/5-6/5-6.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch05-thread/5-6/5-6.v12.suo
--------------------------------------------------------------------------------
/In-depth_C++11/ch05-thread/5-7/5-7.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch05-thread/5-7/5-7.v12.suo
--------------------------------------------------------------------------------
/In-depth_C++11/ch05-thread/5-8/5-8.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch05-thread/5-8/5-8.v12.suo
--------------------------------------------------------------------------------
/In-depth_C++11/ch05-thread/5-9/5-9.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch05-thread/5-9/5-9.v12.suo
--------------------------------------------------------------------------------
/In-depth_C++11/ch05-thread/5-9/5-9/Test.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch05-thread/5-9/5-9/Test.cpp
--------------------------------------------------------------------------------
/In-depth_C++11/ch06-chrono_and_convert/6-1:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch06-chrono_and_convert/6-1
--------------------------------------------------------------------------------
/In-depth_C++11/ch06-chrono_and_convert/6-2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch06-chrono_and_convert/6-2
--------------------------------------------------------------------------------
/In-depth_C++11/ch05-thread/5-10/5-10.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch05-thread/5-10/5-10.v12.suo
--------------------------------------------------------------------------------
/In-depth_C++11/ch05-thread/5-5/5-5/SyncQueue.hpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch05-thread/5-5/5-5/SyncQueue.hpp
--------------------------------------------------------------------------------
/Fluent_Python/ch14-it-generator/isis2json/cds.iso:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch14-it-generator/isis2json/cds.iso
--------------------------------------------------------------------------------
/Fluent_Python/ch14-it-generator/isis2json/cds.mst:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch14-it-generator/isis2json/cds.mst
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags/downloads/bd.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags/downloads/bd.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags/downloads/br.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags/downloads/br.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags/downloads/cd.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags/downloads/cd.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags/downloads/cn.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags/downloads/cn.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags/downloads/de.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags/downloads/de.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags/downloads/eg.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags/downloads/eg.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags/downloads/et.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags/downloads/et.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags/downloads/fr.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags/downloads/fr.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags/downloads/id.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags/downloads/id.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags/downloads/in.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags/downloads/in.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags/downloads/ir.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags/downloads/ir.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags/downloads/jp.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags/downloads/jp.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags/downloads/mx.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags/downloads/mx.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags/downloads/ng.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags/downloads/ng.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags/downloads/ph.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags/downloads/ph.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags/downloads/pk.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags/downloads/pk.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags/downloads/ru.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags/downloads/ru.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags/downloads/tr.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags/downloads/tr.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags/downloads/us.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags/downloads/us.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags/downloads/vn.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags/downloads/vn.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags2/downloads/bd.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags2/downloads/bd.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags2/downloads/br.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags2/downloads/br.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags2/downloads/cd.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags2/downloads/cd.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags2/downloads/cn.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags2/downloads/cn.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags2/downloads/de.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags2/downloads/de.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags2/downloads/eg.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags2/downloads/eg.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags2/downloads/et.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags2/downloads/et.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags2/downloads/fr.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags2/downloads/fr.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags2/downloads/id.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags2/downloads/id.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags2/downloads/in.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags2/downloads/in.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags2/downloads/ir.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags2/downloads/ir.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags2/downloads/jp.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags2/downloads/jp.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags2/downloads/mx.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags2/downloads/mx.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags2/downloads/ng.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags2/downloads/ng.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags2/downloads/ph.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags2/downloads/ph.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags2/downloads/pk.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags2/downloads/pk.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags2/downloads/ru.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags2/downloads/ru.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags2/downloads/tr.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags2/downloads/tr.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags2/downloads/us.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags2/downloads/us.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags2/downloads/vn.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags2/downloads/vn.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch18-asyncio/flags/downloads/bd.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch18-asyncio/flags/downloads/bd.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch18-asyncio/flags/downloads/br.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch18-asyncio/flags/downloads/br.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch18-asyncio/flags/downloads/cd.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch18-asyncio/flags/downloads/cd.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch18-asyncio/flags/downloads/cn.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch18-asyncio/flags/downloads/cn.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch18-asyncio/flags/downloads/de.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch18-asyncio/flags/downloads/de.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch18-asyncio/flags/downloads/eg.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch18-asyncio/flags/downloads/eg.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch18-asyncio/flags/downloads/et.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch18-asyncio/flags/downloads/et.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch18-asyncio/flags/downloads/fr.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch18-asyncio/flags/downloads/fr.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch18-asyncio/flags/downloads/id.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch18-asyncio/flags/downloads/id.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch18-asyncio/flags/downloads/in.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch18-asyncio/flags/downloads/in.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch18-asyncio/flags/downloads/ir.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch18-asyncio/flags/downloads/ir.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch18-asyncio/flags/downloads/jp.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch18-asyncio/flags/downloads/jp.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch18-asyncio/flags/downloads/mx.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch18-asyncio/flags/downloads/mx.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch18-asyncio/flags/downloads/ng.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch18-asyncio/flags/downloads/ng.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch18-asyncio/flags/downloads/ph.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch18-asyncio/flags/downloads/ph.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch18-asyncio/flags/downloads/pk.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch18-asyncio/flags/downloads/pk.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch18-asyncio/flags/downloads/ru.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch18-asyncio/flags/downloads/ru.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch18-asyncio/flags/downloads/tr.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch18-asyncio/flags/downloads/tr.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch18-asyncio/flags/downloads/us.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch18-asyncio/flags/downloads/us.gif
--------------------------------------------------------------------------------
/Fluent_Python/ch18-asyncio/flags/downloads/vn.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch18-asyncio/flags/downloads/vn.gif
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item19-shared_ptr/shared_ptr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Effective_Modern_Cpp/Item19-shared_ptr/shared_ptr.png
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item22-Pimp_Idiom/c++98/code.cc:
--------------------------------------------------------------------------------
1 | #include "widget.h"
2 |
3 | int main(void)
4 | {
5 | Widget w;
6 |
7 | return 0;
8 | }
9 |
10 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item29-move-failure/arr_move.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Effective_Modern_Cpp/Item29-move-failure/arr_move.png
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item29-move-failure/vec_move.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Effective_Modern_Cpp/Item29-move-failure/vec_move.png
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item40-atomic_volatile@std/code:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Effective_Modern_Cpp/Item40-atomic_volatile@std/code
--------------------------------------------------------------------------------
/In-depth_C++11/ch06-chrono_and_convert/6.1/Timer.hpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch06-chrono_and_convert/6.1/Timer.hpp
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-3/3-3.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-3/3-3.v12.suo
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-4/3-4.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-4/3-4.v12.suo
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-5/3-5.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-5/3-5.v12.suo
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-5/3-5/Test.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-5/3-5/Test.cpp
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-9/3-9.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-9/3-9.v12.suo
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-10/3-10.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-10/3-10.v12.suo
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-12/3-12.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-12/3-12.v12.suo
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-13/3-13.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-13/3-13.v12.suo
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-13/3-13/Any.hpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-13/3-13/Any.hpp
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-14/3-14.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-14/3-14.v12.suo
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-15/3-15.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-15/3-15.v12.suo
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-15/3-15/Test.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-15/3-15/Test.cpp
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-17/3-17.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-17/3-17.v12.suo
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-17/3-17/Test.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-17/3-17/Test.cpp
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-18/3-18.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-18/3-18.v12.suo
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-19/3-19.v11.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-19/3-19.v11.suo
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-19/3-19.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-19/3-19.v12.suo
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-19/3-19/Test.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-19/3-19/Test.cpp
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-20/3-20.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-20/3-20.v12.suo
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-20/3-20/Test.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-20/3-20/Test.cpp
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-21/3-21.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-21/3-21.v12.suo
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-21/3-21/Test.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-21/3-21/Test.cpp
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-22/3-22.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-22/3-22.v12.suo
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-23/3-23.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-23/3-23.v12.suo
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-23/3-23/Test.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-23/3-23/Test.cpp
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-24/3-24.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-24/3-24.v12.suo
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-24/3-24/Test.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-24/3-24/Test.cpp
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-25/3-25.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-25/3-25.v12.suo
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-9/3-9/MyDLL.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-9/3-9/MyDLL.dll
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-9/3-9/MyDLL.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-9/3-9/MyDLL.lib
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-10/3-10/MyDLL.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-10/3-10/MyDLL.dll
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-15/3-15/Variant.hpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-15/3-15/Variant.hpp
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-25/3-25/TpZip.hpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-25/3-25/TpZip.hpp
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-5/3-5/optional.hpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-5/3-5/optional.hpp
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags/__pycache__/flags.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags/__pycache__/flags.cpython-36.pyc
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-7~3-8/3-7~3-8.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-7~3-8/3-7~3-8.v12.suo
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item22-Pimp_Idiom/code.cc:
--------------------------------------------------------------------------------
1 | #include "widget.h"
2 |
3 | int main(void)
4 | {
5 |
6 | Widget w; //如果析构函数~Widget()不能实现申明和定义分离,则报错
7 |
8 | return 0;
9 | }
10 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch01-moderner_and_simpler/1-11_1-15_for_range/Test.cc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch01-moderner_and_simpler/1-11_1-15_for_range/Test.cc
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-7~3-8/3-7~3-8/Test.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/In-depth_C++11/ch03-type_traits_and_vargs/3-7~3-8/3-7~3-8/Test.cpp
--------------------------------------------------------------------------------
/Fluent_Python/ch11-iface-abc/tombola_class/__pycache__/bingo.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch11-iface-abc/tombola_class/__pycache__/bingo.cpython-36.pyc
--------------------------------------------------------------------------------
/Fluent_Python/ch11-iface-abc/tombola_class/__pycache__/drum.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch11-iface-abc/tombola_class/__pycache__/drum.cpython-36.pyc
--------------------------------------------------------------------------------
/Fluent_Python/ch11-iface-abc/tombola_class/__pycache__/lotto.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch11-iface-abc/tombola_class/__pycache__/lotto.cpython-36.pyc
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags2/__pycache__/flags2_common.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags2/__pycache__/flags2_common.cpython-36.pyc
--------------------------------------------------------------------------------
/Fluent_Python/ch19-dyn-attr-prop/oscon/__pycache__/osconfeed.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch19-dyn-attr-prop/oscon/__pycache__/osconfeed.cpython-36.pyc
--------------------------------------------------------------------------------
/Fluent_Python/ch04-text-byte/README.rst:
--------------------------------------------------------------------------------
1 | Sample code for Chapter 4 - "Text and bytes"
2 |
3 | From the book "Fluent Python" by Luciano Ramalho (O'Reilly, 2015)
4 | http://shop.oreilly.com/product/0636920032519.do
5 |
--------------------------------------------------------------------------------
/Fluent_Python/ch11-iface-abc/tombola_class/__pycache__/__init__.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch11-iface-abc/tombola_class/__pycache__/__init__.cpython-36.pyc
--------------------------------------------------------------------------------
/Fluent_Python/ch11-iface-abc/tombola_class/__pycache__/tombola.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch11-iface-abc/tombola_class/__pycache__/tombola.cpython-36.pyc
--------------------------------------------------------------------------------
/Fluent_Python/ch17-futures/flags2/__pycache__/flags2_sequential.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch17-futures/flags2/__pycache__/flags2_sequential.cpython-36.pyc
--------------------------------------------------------------------------------
/Fluent_Python/ch11-iface-abc/tombola_class/__pycache__/tombolist.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch11-iface-abc/tombola_class/__pycache__/tombolist.cpython-36.pyc
--------------------------------------------------------------------------------
/Fluent_Python/ch18b-async-await/charfinder/__pycache__/charfinder.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch18b-async-await/charfinder/__pycache__/charfinder.cpython-36.pyc
--------------------------------------------------------------------------------
/Fluent_Python/ch18b-async-await/flags/imported/__pycache__/flags.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch18b-async-await/flags/imported/__pycache__/flags.cpython-36.pyc
--------------------------------------------------------------------------------
/Fluent_Python/ch07-deco-closure/README.rst:
--------------------------------------------------------------------------------
1 | Sample code for Chapter 7 - "Closures and decorators"
2 |
3 | From the book "Fluent Python" by Luciano Ramalho (O'Reilly, 2015)
4 | http://shop.oreilly.com/product/0636920032519.do
5 |
--------------------------------------------------------------------------------
/Fluent_Python/ch14-it-generator/aritprog/class/__pycache__/aritprog_v0.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch14-it-generator/aritprog/class/__pycache__/aritprog_v0.cpython-36.pyc
--------------------------------------------------------------------------------
/Fluent_Python/ch14-it-generator/aritprog/class/__pycache__/aritprog_v1.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch14-it-generator/aritprog/class/__pycache__/aritprog_v1.cpython-36.pyc
--------------------------------------------------------------------------------
/Fluent_Python/ch14-it-generator/aritprog/class/__pycache__/aritprog_v2.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch14-it-generator/aritprog/class/__pycache__/aritprog_v2.cpython-36.pyc
--------------------------------------------------------------------------------
/Fluent_Python/ch14-it-generator/aritprog/class/__pycache__/aritprog_v3.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch14-it-generator/aritprog/class/__pycache__/aritprog_v3.cpython-36.pyc
--------------------------------------------------------------------------------
/Fluent_Python/ch21-class-metaprog/README.rst:
--------------------------------------------------------------------------------
1 | Sample code for Chapter 21 - "Class metaprogramming"
2 |
3 | From the book "Fluent Python" by Luciano Ramalho (O'Reilly, 2015)
4 | http://shop.oreilly.com/product/0636920032519.do
5 |
--------------------------------------------------------------------------------
/Fluent_Python/ch14-it-generator/sentence/class/__pycache__/sentence_gen.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch14-it-generator/sentence/class/__pycache__/sentence_gen.cpython-36.pyc
--------------------------------------------------------------------------------
/Fluent_Python/ch14-it-generator/sentence/class/__pycache__/sentence_gen2.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch14-it-generator/sentence/class/__pycache__/sentence_gen2.cpython-36.pyc
--------------------------------------------------------------------------------
/Fluent_Python/ch14-it-generator/sentence/class/__pycache__/sentence_iter.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch14-it-generator/sentence/class/__pycache__/sentence_iter.cpython-36.pyc
--------------------------------------------------------------------------------
/Fluent_Python/ch14-it-generator/sentence/class/__pycache__/sentence_iter2.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch14-it-generator/sentence/class/__pycache__/sentence_iter2.cpython-36.pyc
--------------------------------------------------------------------------------
/Fluent_Python/ch18b-async-await/flags/imported/__pycache__/flags2_common.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch18b-async-await/flags/imported/__pycache__/flags2_common.cpython-36.pyc
--------------------------------------------------------------------------------
/Fluent_Python/ch10-seq-hacking/README.rst:
--------------------------------------------------------------------------------
1 | Sample code for Chapter 10 - "Sequence hacking, hashing and slicing"
2 |
3 | From the book "Fluent Python" by Luciano Ramalho (O'Reilly, 2015)
4 | http://shop.oreilly.com/product/0636920032519.do
5 |
--------------------------------------------------------------------------------
/Fluent_Python/ch14-it-generator/sentence/class/__pycache__/sentence_genexp.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch14-it-generator/sentence/class/__pycache__/sentence_genexp.cpython-36.pyc
--------------------------------------------------------------------------------
/Fluent_Python/ch14-it-generator/sentence/class/__pycache__/sentence_getitem.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch14-it-generator/sentence/class/__pycache__/sentence_getitem.cpython-36.pyc
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/README.md:
--------------------------------------------------------------------------------
1 | # Effective_Modern_Cpp
2 | <> Chinese version and source code
3 |
4 | in every dir (corresponding to every chaptor)
5 | Use method:
6 | ```
7 | $ make
8 | $ cgdb code
9 | ```
10 |
11 |
--------------------------------------------------------------------------------
/Fluent_Python/ch02-array-seq/genexps.py:
--------------------------------------------------------------------------------
1 | symbols='A中国人'
2 | t=tuple(ord(symbol) for symbol in symbols)
3 | print(t)
4 |
5 | print('---------')
6 | import array
7 | a = array.array('I', (ord(symbol) for symbol in symbols))
8 | print(a)
9 |
10 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Books_SourceCode
2 |
3 | SourceCode collection for Programming Books
4 |
5 | - Effective_Modern_Cpp 《Effective Modern C++》 Chinese version and source code
6 | - Using_STL 《Using the C++ Standard Template Libraries》 中文名《C++标准模板库编程实践》 源码
7 |
--------------------------------------------------------------------------------
/Fluent_Python/ch07-deco-closure/clockdeco/clock_param/__pycache__/clockdeco_param.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/activeion/Books_SourceCode/HEAD/Fluent_Python/ch07-deco-closure/clockdeco/clock_param/__pycache__/clockdeco_param.cpython-36.pyc
--------------------------------------------------------------------------------
/Fluent_Python/ch16-coroutine/c_impl/coro.h:
--------------------------------------------------------------------------------
1 | #ifndef _CORO_H_
2 | #define _CORO_H_
3 |
4 | typedef void (*CoroFunType)(const void*);
5 |
6 | void coro_new(CoroFunType f, const void* arg);
7 | void coro_yield();
8 | void coro_main();
9 |
10 | #endif
11 |
--------------------------------------------------------------------------------
/Fluent_Python/ch07-deco-closure/fibo_demo.py:
--------------------------------------------------------------------------------
1 | from clockdeco import clock
2 |
3 | @clock
4 | def fibonacci(n):
5 | if n < 2:
6 | return n
7 | return fibonacci(n-2) + fibonacci(n-1)
8 |
9 | if __name__=='__main__':
10 | print(fibonacci(6))
11 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-9/3-9/MyDLL.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | extern "C" __declspec(dllexport) int Add(int &a,int &b);
4 |
5 | extern "C" __declspec(dllexport) int Max(const int &a, const int &b);
6 | extern "C" __declspec(dllexport) int Get(const int &a);
--------------------------------------------------------------------------------
/Fluent_Python/ch07-deco-closure/clockdeco/clock_param/clockdeco_param_demo1.py:
--------------------------------------------------------------------------------
1 | import time
2 | from clockdeco_param import clock
3 |
4 | @clock('{name}: {elapsed}s')
5 | def snooze(seconds):
6 | time.sleep(seconds)
7 |
8 | for i in range(3):
9 | snooze(.123)
10 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch08-Pattern/NonCopyable.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | class NonCopyable
3 | {
4 | public:
5 | NonCopyable(const NonCopyable&) = delete; // deleted
6 | NonCopyable& operator = (const NonCopyable&) = delete; // deleted
7 | NonCopyable() = default; // available
8 | };
9 |
--------------------------------------------------------------------------------
/Fluent_Python/ch07-deco-closure/clockdeco/clock_param/clockdeco_param_demo2.py:
--------------------------------------------------------------------------------
1 | import time
2 | from clockdeco_param import clock
3 |
4 | @clock('{name}({args}) dt={elapsed:0.3f}s')
5 | def snooze(seconds):
6 | time.sleep(seconds)
7 |
8 | for i in range(3):
9 | snooze(.123)
10 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch01-moderner_and_simpler/1-06_》.cc:
--------------------------------------------------------------------------------
1 | template
2 | struct Foo
3 | {
4 | typedef T type;
5 | };
6 |
7 | template
8 | class A
9 | {
10 | //...
11 | };
12 |
13 | int main(void)
14 | {
15 | Foo>::type xx; //C++98/03编译出错。
16 |
17 | return 0;
18 | }
19 |
20 |
--------------------------------------------------------------------------------
/Fluent_Python/ch07-deco-closure/fibo_demo_lru.py:
--------------------------------------------------------------------------------
1 | import functools
2 |
3 | from clockdeco import clock
4 |
5 | @functools.lru_cache() # <1>
6 | @clock # <2>
7 | def fibonacci(n):
8 | if n < 2:
9 | return n
10 | return fibonacci(n-2) + fibonacci(n-1)
11 |
12 | if __name__=='__main__':
13 | print(fibonacci(6))
14 |
--------------------------------------------------------------------------------
/Fluent_Python/ch05-1class-func/factorial.py:
--------------------------------------------------------------------------------
1 | def factorial(n):
2 | ''' returns n! '''
3 | return 1 if n<2 else n*factorial(n-1)
4 |
5 | print(factorial(42))
6 | print(factorial.__doc__)
7 | print(type(factorial))
8 |
9 |
10 | fact = factorial
11 | print(fact)
12 | print(fact(5))
13 | print(map(factorial, range(11)))
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Fluent_Python/ch07-deco-closure/clockdeco/clockdeco/fibo_demo.py:
--------------------------------------------------------------------------------
1 | # import functools
2 | from clockdeco import clock
3 |
4 | # @functools.lru_cache()
5 | @clock
6 | def fibonacci(n):
7 | if n<2:
8 | return n
9 | else:
10 | return fibonacci(n-2) + fibonacci(n-1)
11 |
12 | if __name__ == '__main__':
13 | print(fibonacci(30))
14 |
--------------------------------------------------------------------------------
/Fluent_Python/ch07-deco-closure/clockdeco/clockdeco/fibo_demo_lru.py:
--------------------------------------------------------------------------------
1 | import functools
2 | from clockdeco import clock
3 |
4 | @functools.lru_cache()
5 | @clock
6 | def fibonacci(n):
7 | if n<2:
8 | return n
9 | else:
10 | return fibonacci(n-2) + fibonacci(n-1)
11 |
12 | if __name__ == '__main__':
13 | print(fibonacci(30))
14 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch06_sudoku/sudoku.h:
--------------------------------------------------------------------------------
1 | #ifndef MUDUO_EXAMPLES_SUDOKU_SUDOKU_H
2 | #define MUDUO_EXAMPLES_SUDOKU_SUDOKU_H
3 |
4 |
5 | #include
6 | #include
7 |
8 | muduo::string solveSudoku(const muduo::StringPiece& puzzle);
9 | const int kCells = 81;
10 | extern const char kNoSolution[];
11 |
12 | #endif
13 |
--------------------------------------------------------------------------------
/Using_STL/data/fibonacci.txt:
--------------------------------------------------------------------------------
1 | 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 2178309 3524578 5702887 9227465 14930352 24157817 39088169 63245986 102334155 165580141 267914296 433494437 701408733 1134903170 1836311903 2971215073 4807526976 7778742049 12586269025 20365011074
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-22/3-22/TpIndexs.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | template
4 | struct IndexTuple {};
5 |
6 | template
7 | struct make_indexes : make_indexes{};
8 |
9 | template
10 | struct make_indexes<0, Indexs...>
11 | {
12 | typedef IndexTuple type;
13 | };
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s00_EventLoop/test2.cc:
--------------------------------------------------------------------------------
1 | #include "EventLoop.h"
2 | #include
3 |
4 | muduo::EventLoop* g_loop;
5 |
6 | void threadFunc()
7 | {
8 | g_loop->loop();
9 | }
10 |
11 | int main()
12 | {
13 | muduo::EventLoop loop;
14 | g_loop = &loop;
15 | muduo::Thread t(threadFunc);
16 | t.start();
17 | t.join();
18 | }
19 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s13_epoll/test2.cc:
--------------------------------------------------------------------------------
1 | #include "EventLoop.h"
2 | #include
3 |
4 | muduo::EventLoop* g_loop;
5 |
6 | void threadFunc()
7 | {
8 | g_loop->loop();
9 | }
10 |
11 | int main()
12 | {
13 | muduo::EventLoop loop;
14 | g_loop = &loop;
15 | muduo::Thread t(threadFunc);
16 | t.start();
17 | t.join();
18 | }
19 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item29-move-failure/code.cc:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main(void)
4 | {
5 |
6 | std::vector vw1;
7 | // put data into vw1
8 |
9 | //...
10 |
11 | // move vw1 into vw2. Runs in
12 | // constant time. Only ptrs
13 | // in vw1 and vw2 are modified
14 | auto vw2 = std::move(vw1);
15 |
16 | return 0;
17 | }
18 |
--------------------------------------------------------------------------------
/Fluent_Python/ch06-dp-1class-func/README.rst:
--------------------------------------------------------------------------------
1 | Sample code for Chapter 6 - "Design patterns with first class functions"
2 |
3 | From the book "Fluent Python" by Luciano Ramalho (O'Reilly, 2015)
4 | http://shop.oreilly.com/product/0636920032519.do
5 |
6 |
7 | classic_strategy.py 传统的策略默认, 继承抽象类(虚函数),重写虚函数的做法
8 | strategy_func.py 函数式编程
9 | strategy_best.py 在函数式编程的基础上,进一步优选“促销策略”
10 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item22-Pimp_Idiom/c++98/widget.h:
--------------------------------------------------------------------------------
1 | class Widget{ // 还是在头文件"widget.h"中
2 | public:
3 | Widget();
4 | ~Widget(); // 看下面的内容可以得知析构函数是需要的
5 | //...
6 |
7 | private:
8 | struct Impl; // 声明一个要实现的结构
9 | Impl *pImpl; // 并用指针指向它
10 | };
11 |
--------------------------------------------------------------------------------
/Fluent_Python/ch14-it-generator/aritprog/class/aritprog_v3.py:
--------------------------------------------------------------------------------
1 | # BEGIN ARITPROG_ITERTOOLS
2 | import itertools
3 |
4 |
5 | def aritprog_gen(begin, step, end=None):
6 | first = type(begin + step)(begin)
7 | ap_gen = itertools.count(first, step)
8 | if end is not None:
9 | ap_gen = itertools.takewhile(lambda n: n < end, ap_gen)
10 | return ap_gen
11 | # END ARITPROG_ITERTOOLS
12 |
--------------------------------------------------------------------------------
/Fluent_Python/ch07-deco-closure/registration_abridged.py:
--------------------------------------------------------------------------------
1 | # BEGIN REGISTRATION_ABRIDGED
2 | registry = []
3 |
4 | def register(func):
5 | print('running register(%s)' % func)
6 | registry.append(func)
7 | return func
8 |
9 | @register
10 | def f1():
11 | print('running f1()')
12 |
13 | print('running main()')
14 | print('registry ->', registry)
15 | f1()
16 | # END REGISTRATION_ABRIDGED
17 |
--------------------------------------------------------------------------------
/Fluent_Python/ch02-array-seq/cartesian.py:
--------------------------------------------------------------------------------
1 | colors = ['black', 'white']
2 | sizes = ['S', 'M', 'L']
3 | tshirts = [(color, size) for color in colors for size in sizes]
4 | print(tshirts)
5 |
6 | print('-------')
7 | for color in colors:
8 | for size in sizes:
9 | print((color, size))
10 |
11 | print('-------')
12 | tshirts = [(color,size) for size in sizes for color in colors]
13 | print(tshirts)
14 |
--------------------------------------------------------------------------------
/Using_STL/data/temperatures.txt:
--------------------------------------------------------------------------------
1 | 64.2394 69.2322 61.0484 32.066 70.503 33.7685 47.9791 56.3185 35.5881 61.1607 63.632 63.8291 65.8318 39.9963 46.9024 22.2147 32.9985 45.7904 42.0893 56.0469 50.2636 59.495 55.2646 55.4269 68.2306 48.6161 62.4015 41.8968 44.2749 53.0329 71.4646 81.7624 58.7414 19.5849 45.488 50.1976 44.5752 67.8068 64.447 66.0774 57.4047 30.3737 43.9931 70.2875 68.5318 45.6778 61.845 34.9825 52.1552 18.3537
--------------------------------------------------------------------------------
/Fluent_Python/ch19-dyn-attr-prop/pseudo_construction.py:
--------------------------------------------------------------------------------
1 | # pseudo-code for object construction
2 | def object_maker(the_class, some_arg):
3 | new_object = the_class.__new__(some_arg)
4 | if isinstance(new_object, the_class):
5 | the_class.__init__(new_object, some_arg)
6 | return new_object
7 |
8 | # the following statements are roughly equivalent
9 | x = Foo('bar')
10 | x = object_maker(Foo, 'bar')
11 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch08-Pattern/Visitor.hpp:
--------------------------------------------------------------------------------
1 | template
2 | struct Visitor;
3 |
4 | template
5 | struct Visitor : Visitor
6 | {
7 | using Visitor::Visit;//通过using避免隐藏基类的visit同名方法
8 | virtual void Visit(const T&) = 0;
9 | };
10 |
11 | template
12 | struct Visitor
13 | {
14 | virtual void Visit(const T&) = 0;
15 | };
16 |
--------------------------------------------------------------------------------
/Fluent_Python/ch05-1class-func/functor.py:
--------------------------------------------------------------------------------
1 | fruits = [ 'strawberry', 'fig', 'apple', 'cherry', 'raspberry', 'banana']
2 | print(sorted(fruits, key=len))
3 |
4 | def reverse(word):
5 | return word[::-1]
6 |
7 | print(reverse('testing'))
8 |
9 | print(sorted(fruits, key=reverse))
10 |
11 |
12 | class C: pass
13 | obj = C()
14 | def func(): pass
15 | fun_prop = sorted(set(dir(func)) - set(dir(obj)))
16 | print(fun_prop)
17 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-25/3-25/Test.cpp:
--------------------------------------------------------------------------------
1 | #include "TpZip.hpp"
2 | #include
3 |
4 | void TupleZip()
5 | {
6 | auto tp1 = std::make_tuple(1, 2, 2.5, 'a');
7 | auto tp2 = std::make_tuple(1.5, 2, 2.5, 'z');
8 | auto mypairs = Zip(tp1, tp2);
9 | }
10 |
11 | int main(void)
12 | {
13 | TupleZip();
14 |
15 | system("pause");
16 | return 0;
17 | }
--------------------------------------------------------------------------------
/Fluent_Python/ch16-coroutine/coroaverager/coroaverager1-prime/coroutil.py:
--------------------------------------------------------------------------------
1 | # BEGIN CORO_DECO
2 | from functools import wraps
3 |
4 | def coroutine(func):
5 | """Decorator: primes `func` by advancing to first `yield`"""
6 | @wraps(func)
7 | def primer(*args,**kwargs): # <1>
8 | gen = func(*args,**kwargs) # <2>
9 | next(gen) # <3>
10 | return gen # <4>
11 | return primer
12 | # END CORO_DECO
13 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch04-smart-pointer/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = 4-1
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 | 4-1: 4-1.cc
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Fluent_Python/ch07-deco-closure/average/average_oo.py:
--------------------------------------------------------------------------------
1 | """
2 | >>> avg = Averager()
3 | >>> avg(10)
4 | 10.0
5 | >>> avg(11)
6 | 10.5
7 | >>> avg(12)
8 | 11.0
9 |
10 | """
11 |
12 |
13 | class Averager():
14 |
15 | def __init__(self):
16 | self.series = []
17 |
18 | def __call__(self, new_value):
19 | self.series.append(new_value)
20 | total = sum(self.series)
21 | return total/len(self.series)
22 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item07-initializer/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: code.cc
18 |
19 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch01-moderner_and_simpler/1-03_decltype.cc:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | class Foo
4 | {
5 | public:
6 | static const int Number = 0;
7 | int x;
8 | };
9 |
10 | int main(void)
11 | {
12 | int n = 0;
13 | volatile const int &x = n;
14 |
15 | decltype(n) a = n; //a -> int
16 | decltype(x) b = n; //b -> const volatile int &
17 |
18 | decltype(Foo::Number) c = 0; //c -> const int
19 |
20 | return 0;
21 | }
22 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch01-moderner_and_simpler/1-08_init.cc:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | class Foo
4 | {
5 | public:
6 | Foo(int){}
7 |
8 | private:
9 | Foo(const Foo&);
10 | };
11 |
12 | int main(void)
13 | {
14 | Foo a1(123);
15 | //Foo a2 = a1; //error C2248: “Foo::Foo”: 无法访问 private 成员(在“Foo”类中声明)
16 | Foo a3 = { 123 };
17 | Foo a4{ 123 };
18 |
19 | int a5 = { 3 };
20 | int a6 { 3 };
21 |
22 | system("pause");
23 | return 0;
24 | }
25 |
--------------------------------------------------------------------------------
/Using_STL/Checkout/main.cc:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include "customer.h"
4 | #include "checkout.h"
5 |
6 | int main(void)
7 | {
8 | Checkout c;
9 |
10 | for(int i=0; i<5; ++i)
11 | c.addCustomer(std::make_unique(2));
12 |
13 | for(int i=0; i< 100; ++i) {
14 | if(!i%3) c.addCustomer(std::make_unique(2));
15 | c.timeTicks();
16 | }
17 |
18 | return 0;
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/Using_STL/Checkout/Checkout_up/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. # -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = # -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 | code: CXXFLAGS += -Wall
17 | code: code.cc
18 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item12-override/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 | code: CXXFLAGS += -Wall
17 | code: code.cc
18 |
--------------------------------------------------------------------------------
/Fluent_Python/ch11-iface-abc/tombola_class/drum.py:
--------------------------------------------------------------------------------
1 | from random import shuffle
2 |
3 | from tombola_class.tombola import Tombola
4 |
5 |
6 | class TumblingDrum(Tombola):
7 |
8 | def __init__(self, iterable):
9 | self._balls = []
10 | self.load(iterable)
11 |
12 | def load(self, iterable):
13 | self._balls.extend(iterable)
14 | shuffle(self._balls)
15 |
16 | def pick(self):
17 | return self._balls.pop()
18 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item37-unjoinable/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item41-always_copy/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item42-emplace_back/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item01-template_deduction/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 | code: CXXFLAGS += -Wall
17 | code: code.cc
18 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item02-auto_deduction/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item03-decltype/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item05-use_auto/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item08-nullptr/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | #code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item10-scoped_enum/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 | #code: CXXFLAGS += -Wall
17 | code: code.cc
18 |
19 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item11-deleted/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | #code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item14-noexcept/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item15-constexpr/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 | #code: CXXFLAGS += -Wall
17 | code: code.cc
18 |
19 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item20-weak_ptr/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item30-imperfect_forward/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item32-use_init_capture/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item33-universal_auto_in_lambda/code.cc:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | void func(int x)
5 | {
6 | std::cout<(param)));
17 | };
18 | f(2);
19 |
20 | return 0;
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch01-moderner_and_simpler/1-07_init.cc:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int i_arr[3] = { 1, 2, 3 }; //普通数组
4 |
5 | struct A
6 | {
7 | int x;
8 | struct B
9 | {
10 | int i;
11 | int j;
12 | } b;
13 | } a = { 1, {2, 3} }; //POD类型
14 |
15 | int i = 0;
16 |
17 | class Foo
18 | {
19 | public:
20 | Foo(int){}
21 | } foo = 123;
22 |
23 | int j(0);
24 |
25 | Foo bar(123);
26 |
27 | int main(void)
28 | {
29 |
30 | system("pause");
31 | return 0;
32 | }
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-13/3-13/源.cpp:
--------------------------------------------------------------------------------
1 | #include "Any.hpp"
2 |
3 | #include
4 | #include
5 |
6 | void TestAny()
7 | {
8 | Any n;
9 | auto r = n.IsNull();//true
10 | std::string s1 = "hello";
11 | n = s1;
12 | n = "world";
13 | n.AnyCast(); //can not cast int to string
14 | Any n1 = 1;
15 | n1.Is(); //true
16 | }
17 |
18 |
19 | int main(void)
20 | {
21 | TestAny();
22 |
23 | system("pause");
24 | return 0;
25 | }
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch06_sudoku/README:
--------------------------------------------------------------------------------
1 | batch.cc muduo客户端 sudoku_client_batch req.txt localhost 18
2 | pipeline.cc muduo客户端 sudoku_client_pipeline req.txt localhost 18
3 |
4 |
5 | server_basic.cc muduo单线程
6 | server_threadpool.cc muduo IO单线程 + threadpool计算多线程
7 | server_multiloop.cc muduo Acceptor单线程 + IO多线程
8 | server_hybrid.cc muduo Acceptor单线程 + IO多线程 + threadpool计算多线程
9 | server_prod.cc 改进server_hybrid.cc: 高低水位
10 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item06-not_use_auto/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item19-shared_ptr/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item23-move_forward/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item29-move-failure/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item31-avoid_default_capture/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item34-prefer_lambda_to_bind/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item35-prefer_task_to_thread/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
--------------------------------------------------------------------------------
/Using_STL/data/Renewables_vs_kwh_cost.txt:
--------------------------------------------------------------------------------
1 | Austria 353 20.21
2 | Belgium 452 20.97
3 | Denmark 956 30.42
4 | Croatia 89 13.12
5 | Finland 114 15.63
6 | Germany 969 29.81
7 | Greece 424 17.67
8 | Hungary 37 12.02
9 | Ireland 483 24.07
10 | Italy 453 24.46
11 | Netherland 234 18.21
12 | Poland 100 14.21
13 | Portuga1 517 21.75
14 | Spain 596 22.52
15 | Sweden 561 19.67
16 | UK 257 19.18
17 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item04-check_deduced_type/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item09-using_vs_typedef/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | #code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item33-universal_auto_in_lambda/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item38-varying_thread_destructor/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item40-atomic_volatile@std/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item16-make_const_thread_safe/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item22-Pimp_Idiom/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc widget.cc
19 |
20 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item24-universal_reference/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item28-reference_collapsing/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item36-async_if_asynchronicity@launch@std/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
--------------------------------------------------------------------------------
/Fluent_Python/ch07-deco-closure/clockdeco/clockdeco/clockdeco.py:
--------------------------------------------------------------------------------
1 | # clockdeco.py
2 |
3 | import time
4 |
5 |
6 | def clock(func):
7 | def clocked(*args):
8 | t0 = time.time()
9 | result = func(*args)
10 | elapsed = time.time() - t0
11 | name = func.__name__
12 | arg_str = ', '.join(repr(arg) for arg in args)
13 | print('[%0.8fs] %s(%s) -> %r' % (elapsed, name, arg_str, result))
14 | return result
15 | return clocked
16 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch08-Pattern/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = 8-3 8-5
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | 8-3: 8-3.cc
18 |
19 | 8-5: CXXFLAGS += -Wall
20 | 8-5: 8-5.cc
21 |
22 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item21-make_shared_make_uniqure/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item26-avoid_overload@universal/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item25-move@rvalue_forward@universal/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item27-alternatives_to_overload@universal/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 |
--------------------------------------------------------------------------------
/Fluent_Python/ch16-coroutine/c_impl/main.cc:
--------------------------------------------------------------------------------
1 | #include "coro.h"
2 | #include
3 | #include
4 |
5 | void co1(const void* msg)
6 | {
7 | for (int i = 0; i != 5; ++i)
8 | {
9 | printf("%s\n", (char*)msg);
10 | coro_yield();
11 | }
12 | }
13 |
14 | int main(int ac, char** av)
15 | {
16 | assert(sizeof(void*) == sizeof(unsigned long));
17 |
18 | coro_new(co1, "hello");
19 | coro_new(co1, "world");
20 | coro_main();
21 | return 0;
22 | }
23 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch01-moderner_and_simpler/1-02_auto.cc:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | class Foo
4 | {
5 | public:
6 | static int get(void)
7 | {
8 | return 0;
9 | }
10 | };
11 |
12 | class Bar
13 | {
14 | public:
15 | static const char* get(void)
16 | {
17 | return "0";
18 | }
19 | };
20 |
21 | template
22 | void func(void)
23 | {
24 | auto val = A::get();
25 |
26 | //...
27 | }
28 |
29 | int main(void)
30 | {
31 | func();
32 | func();
33 |
34 | return 0;
35 | }
36 |
--------------------------------------------------------------------------------
/Fluent_Python/ch16-coroutine/c_impl/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread -lmuduo_net -lmuduo_base
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = main
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | main: CXXFLAGS += -Wall
18 | main: main.cc coro.cc
19 |
20 |
--------------------------------------------------------------------------------
/Fluent_Python/ch18-asyncio/charfinder/http_charfinder.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Charfinder
6 |
7 |
8 | Examples: {links}
9 |
10 |
14 |
15 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-22/3-22/Test.cpp:
--------------------------------------------------------------------------------
1 | #include "TpForeach.hpp"
2 | #include
3 |
4 | struct Functor
5 | {
6 | template
7 | void operator()(T& t) const
8 | {
9 | //t.doSomething();
10 | std::cout << t << std::endl;
11 | }
12 | };
13 |
14 | void TestTupleForeach()
15 | {
16 | tp_for_each(Functor(), std::make_tuple(1, 2.5));
17 | }
18 |
19 | int main(void)
20 | {
21 | TestTupleForeach();
22 |
23 | system("pause");
24 | return 0;
25 | }
--------------------------------------------------------------------------------
/Fluent_Python/ch18b-async-await/charfinder/http_charfinder.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Charfinder
6 |
7 |
8 | Examples: {links}
9 |
10 |
14 |
15 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch01-moderner_and_simpler/1-19.cc:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | void call_when_even(int x, const std::function& f)
5 | {
6 | if (!(x & 1)) //x % 2 == 0
7 | {
8 | f(x);
9 | }
10 | }
11 |
12 | void output(int x)
13 | {
14 | std::cout << x << " ";
15 | }
16 |
17 | int main(void)
18 | {
19 | for (int i = 0; i < 10; ++i)
20 | {
21 | call_when_even(i, output);
22 | }
23 |
24 | std::cout << std::endl;
25 |
26 | system("pause");
27 | return 0;
28 | }
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item18-unique_ptr/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code printargs
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 | printargs: printargs.cc
21 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item22-Pimp_Idiom/c++98/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread -lmuduo_net -lmuduo_base
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc widget.cc
19 |
20 |
--------------------------------------------------------------------------------
/Fluent_Python/ch06-dp-1class-func/strategy_func/c++_version/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread -lmuduo_net -lmuduo_base
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item13-const_iterator/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = find_and_insert
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 | #find_and_insert: CXXFLAGS += -Wall
17 | find_and_insert: find_and_insert.cc
18 |
19 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item17-autogen_member_functions/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code default
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 | default: default.cc
21 |
22 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch06-chrono_and_convert/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = 6-1 6-2 6-3
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 | 6-1: 6.1/Test.cc
17 |
18 | 6-2: 6-2.cc
19 |
20 | 6-3: CXXFLAGS += -Wall
21 | 6-3: 6-3.cc
22 |
23 |
--------------------------------------------------------------------------------
/Fluent_Python/ch19-dyn-attr-prop/doc_property.py:
--------------------------------------------------------------------------------
1 | """
2 | Example of property documentation
3 |
4 | >>> f = Foo()
5 | >>> f.bar = 77
6 | >>> f.bar
7 | 77
8 | >>> Foo.bar.__doc__
9 | 'The bar attribute'
10 | """
11 |
12 | # BEGIN DOC_PROPERTY
13 | class Foo:
14 |
15 | @property
16 | def bar(self):
17 | '''The bar attribute'''
18 | return self.__dict__['bar']
19 |
20 | @bar.setter
21 | def bar(self, value):
22 | self.__dict__['bar'] = value
23 | # END DOC_PROPERTY
24 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s01_timerfd/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread -lmuduo_net -lmuduo_base
3 | BASE_SRC =
4 | LIB_SRC = EventLoop.cc \
5 | Poller.cc Channel.cc # s01
6 | BINARIES = test3
7 | HEADERS=$(wildcard *.h)
8 |
9 | all: $(BINARIES)
10 | $(BINARIES): $(HEADERS)
11 | $(BINARIES):
12 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
13 |
14 | clean:
15 | rm -f $(BINARIES) core
16 |
17 | test3: test3.cc # s01
18 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item22-Pimp_Idiom/widget.cc:
--------------------------------------------------------------------------------
1 | #include "widget.h"
2 | #include "gadget.h"
3 | #include
4 | #include
5 |
6 | struct Widget::Impl { // 和以前一样
7 | std::string name;
8 | std::vector data;
9 | Gadget g1, g2, g3;
10 | };
11 |
12 | //Widget::~Widget(){} //显式地定义析构函数, 申明和定义分离
13 | Widget::~Widget() = default; //效果同上
14 |
15 | Widget::Widget() //通过std::make_unique来创建一个std::unique_ptr
16 | : pImpl(std::make_unique())
17 | {}
18 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item39-void_futures/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = code ConditionVariable
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | code: CXXFLAGS += -Wall
18 | code: code.cc
19 |
20 | ConditionVariable: ConditionVariable.cc
21 |
22 |
--------------------------------------------------------------------------------
/Fluent_Python/ch07-deco-closure/clockdeco/clockdeco/clockdeco_demo.py:
--------------------------------------------------------------------------------
1 | # clockdeco_demo.py
2 |
3 | import time
4 | from clockdeco import clock
5 |
6 | @clock
7 | def snooze(seconds):
8 | time.sleep(seconds)
9 |
10 | @clock
11 | def factorial(n):
12 | if n<2:
13 | return 1
14 | else:
15 | return n*factorial(n-1)
16 |
17 | if __name__=='__main__':
18 | print('*' * 40, 'Calling snooze(.123)')
19 | snooze(.123)
20 | print('*' * 40, 'Calling factorial(6)')
21 | print('6! =', factorial(6))
22 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s00_EventLoop/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread -lmuduo_net -lmuduo_base
3 | BASE_SRC =
4 | LIB_SRC = EventLoop.cc # s00
5 | BINARIES = test1 test2
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 |
18 | test1: test1.cc
19 | test2: test2.cc
20 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item22-Pimp_Idiom/c++98/widget.cc:
--------------------------------------------------------------------------------
1 | #include "widget.h" //在实现文件"widget.cpp"中
2 | #include "gadget.h"
3 | #include
4 | #include
5 |
6 | struct Widget::Impl{ // 带有之前在Widget中的数据成员的
7 | std::string name; // Widget::Impl的定义
8 | std::vector data;
9 | Gadget g1, g2, g3;
10 | };
11 |
12 | Widget::Widget() // 分配Widget对象的数据成员
13 | : pImpl(new Impl)
14 | {}
15 |
16 | Widget::~Widget() // 归还这个对象的数据成员
17 | { delete pImpl; }
18 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-10/3-10/Test.cpp:
--------------------------------------------------------------------------------
1 | #include "DllParser.hpp"
2 |
3 | #include
4 |
5 | void TestDllParser()
6 | {
7 | DllParser dllParser;
8 | std::string str("MyDLL.dll");
9 |
10 | dllParser.Load(str);
11 |
12 | int a = 5;
13 | int b = 8;
14 |
15 | auto max = dllParser.ExcecuteFunc("Max", a, b);
16 | auto add = dllParser.ExcecuteFunc("Add", a, b);
17 | }
18 |
19 | int main(void)
20 | {
21 | TestDllParser();
22 |
23 | system("pause");
24 | return 0;
25 | }
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/Makefile:
--------------------------------------------------------------------------------
1 | SUBDIRS = s00_EventLoop \
2 | s01_timerfd \
3 | s00_TimerQueue \
4 | s03_runInLoop \
5 | s04_Acceptor \
6 | s05_TcpConnection \
7 | s06_TcpConnection \
8 | s07_Buffer \
9 | s08_send \
10 | s09_SIGPIPE \
11 | s10_multithread \
12 | s11_Connector \
13 | s12_TcpClient \
14 | s13_epoll
15 |
16 | all: $(SUBDIRS)
17 |
18 | clean:
19 | for d in $(SUBDIRS); do cd $$d && make clean && cd ..; done
20 |
21 | $(SUBDIRS):
22 | cd $@ && make
23 |
24 | .PHONY: all clean $(SUBDIRS)
25 |
--------------------------------------------------------------------------------
/Fluent_Python/ch14-it-generator/sentence/class/sentence_gen2.py:
--------------------------------------------------------------------------------
1 | """
2 | Sentence: iterate over words using a generator function
3 | """
4 |
5 | import re
6 | import reprlib
7 |
8 | RE_WORD = re.compile('\w+')
9 |
10 |
11 | class Sentence:
12 |
13 | def __init__(self, text):
14 | self.text = text # <1>
15 |
16 | def __repr__(self):
17 | return 'Sentence(%s)' % reprlib.repr(self.text)
18 |
19 | def __iter__(self):
20 | for match in RE_WORD.finditer(self.text): # <2>
21 | yield match.group() # <3>
22 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s08_send/Timer.cc:
--------------------------------------------------------------------------------
1 | // excerpts from http://code.google.com/p/muduo/
2 | //
3 | // Use of this source code is governed by a BSD-style license
4 | // that can be found in the License file.
5 | //
6 | // Author: Shuo Chen (chenshuo at chenshuo dot com)
7 |
8 | #include "Timer.h"
9 |
10 | using namespace muduo;
11 |
12 | void Timer::restart(Timestamp now)
13 | {
14 | if (repeat_)
15 | {
16 | expiration_ = addTime(now, interval_);
17 | }
18 | else
19 | {
20 | expiration_ = Timestamp::invalid();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s02_TimerQueue/Timer.cc:
--------------------------------------------------------------------------------
1 | // excerpts from http://code.google.com/p/muduo/
2 | //
3 | // Use of this source code is governed by a BSD-style license
4 | // that can be found in the License file.
5 | //
6 | // Author: Shuo Chen (chenshuo at chenshuo dot com)
7 |
8 | #include "Timer.h"
9 |
10 | using namespace muduo;
11 |
12 | void Timer::restart(Timestamp now)
13 | {
14 | if (repeat_)
15 | {
16 | expiration_ = addTime(now, interval_);
17 | }
18 | else
19 | {
20 | expiration_ = Timestamp::invalid();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s03_runInLoop/Timer.cc:
--------------------------------------------------------------------------------
1 | // excerpts from http://code.google.com/p/muduo/
2 | //
3 | // Use of this source code is governed by a BSD-style license
4 | // that can be found in the License file.
5 | //
6 | // Author: Shuo Chen (chenshuo at chenshuo dot com)
7 |
8 | #include "Timer.h"
9 |
10 | using namespace muduo;
11 |
12 | void Timer::restart(Timestamp now)
13 | {
14 | if (repeat_)
15 | {
16 | expiration_ = addTime(now, interval_);
17 | }
18 | else
19 | {
20 | expiration_ = Timestamp::invalid();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s04_Acceptor/Timer.cc:
--------------------------------------------------------------------------------
1 | // excerpts from http://code.google.com/p/muduo/
2 | //
3 | // Use of this source code is governed by a BSD-style license
4 | // that can be found in the License file.
5 | //
6 | // Author: Shuo Chen (chenshuo at chenshuo dot com)
7 |
8 | #include "Timer.h"
9 |
10 | using namespace muduo;
11 |
12 | void Timer::restart(Timestamp now)
13 | {
14 | if (repeat_)
15 | {
16 | expiration_ = addTime(now, interval_);
17 | }
18 | else
19 | {
20 | expiration_ = Timestamp::invalid();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s07_Buffer/Timer.cc:
--------------------------------------------------------------------------------
1 | // excerpts from http://code.google.com/p/muduo/
2 | //
3 | // Use of this source code is governed by a BSD-style license
4 | // that can be found in the License file.
5 | //
6 | // Author: Shuo Chen (chenshuo at chenshuo dot com)
7 |
8 | #include "Timer.h"
9 |
10 | using namespace muduo;
11 |
12 | void Timer::restart(Timestamp now)
13 | {
14 | if (repeat_)
15 | {
16 | expiration_ = addTime(now, interval_);
17 | }
18 | else
19 | {
20 | expiration_ = Timestamp::invalid();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s09_SIGPIPE/Timer.cc:
--------------------------------------------------------------------------------
1 | // excerpts from http://code.google.com/p/muduo/
2 | //
3 | // Use of this source code is governed by a BSD-style license
4 | // that can be found in the License file.
5 | //
6 | // Author: Shuo Chen (chenshuo at chenshuo dot com)
7 |
8 | #include "Timer.h"
9 |
10 | using namespace muduo;
11 |
12 | void Timer::restart(Timestamp now)
13 | {
14 | if (repeat_)
15 | {
16 | expiration_ = addTime(now, interval_);
17 | }
18 | else
19 | {
20 | expiration_ = Timestamp::invalid();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s05_TcpConnection/Timer.cc:
--------------------------------------------------------------------------------
1 | // excerpts from http://code.google.com/p/muduo/
2 | //
3 | // Use of this source code is governed by a BSD-style license
4 | // that can be found in the License file.
5 | //
6 | // Author: Shuo Chen (chenshuo at chenshuo dot com)
7 |
8 | #include "Timer.h"
9 |
10 | using namespace muduo;
11 |
12 | void Timer::restart(Timestamp now)
13 | {
14 | if (repeat_)
15 | {
16 | expiration_ = addTime(now, interval_);
17 | }
18 | else
19 | {
20 | expiration_ = Timestamp::invalid();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s06_TcpConnection/Timer.cc:
--------------------------------------------------------------------------------
1 | // excerpts from http://code.google.com/p/muduo/
2 | //
3 | // Use of this source code is governed by a BSD-style license
4 | // that can be found in the License file.
5 | //
6 | // Author: Shuo Chen (chenshuo at chenshuo dot com)
7 |
8 | #include "Timer.h"
9 |
10 | using namespace muduo;
11 |
12 | void Timer::restart(Timestamp now)
13 | {
14 | if (repeat_)
15 | {
16 | expiration_ = addTime(now, interval_);
17 | }
18 | else
19 | {
20 | expiration_ = Timestamp::invalid();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s10_multithread/Timer.cc:
--------------------------------------------------------------------------------
1 | // excerpts from http://code.google.com/p/muduo/
2 | //
3 | // Use of this source code is governed by a BSD-style license
4 | // that can be found in the License file.
5 | //
6 | // Author: Shuo Chen (chenshuo at chenshuo dot com)
7 |
8 | #include "Timer.h"
9 |
10 | using namespace muduo;
11 |
12 | void Timer::restart(Timestamp now)
13 | {
14 | if (repeat_)
15 | {
16 | expiration_ = addTime(now, interval_);
17 | }
18 | else
19 | {
20 | expiration_ = Timestamp::invalid();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = 3-1 3-2 enable_if 3-16
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 | 3-1: 3-1.cc
17 |
18 | 3-2: CXXFLAGS += -Wall
19 | 3-2: 3-2.cc
20 |
21 | enable_if: enable_if.cc
22 |
23 |
24 | 3-16: 3.16/Test.cc
25 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s02_TimerQueue/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread -lmuduo_net -lmuduo_base
3 | BASE_SRC =
4 | LIB_SRC = EventLoop.cc \
5 | Poller.cc Channel.cc \
6 | Timer.cc TimerQueue.cc # s02
7 | BINARIES = test4
8 | HEADERS=$(wildcard *.h)
9 |
10 | all: $(BINARIES)
11 | $(BINARIES): $(HEADERS)
12 | $(BINARIES):
13 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
14 |
15 | clean:
16 | rm -f $(BINARIES) core
17 |
18 |
19 | test4: test4.cc # s02
20 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch02-rvalue/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = 2-1 2-2 2-3 2-4 2-5 2-6
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 | 2-1: 2-1.cc
17 |
18 | 2-2: 2-2.cc
19 |
20 | 2-3: CXXFLAGS += -Wall
21 | 2-3: 2-3.cc
22 |
23 | 2-4: 2-4.cc
24 |
25 | 2-5: 2-5.cc
26 |
27 | 2-6: 2-6.cc
28 |
29 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread -lmuduo_net -lmuduo_base
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = ch01 ch02 ch05
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | ch01: CXXFLAGS += -Wall
18 | ch01: ch01.cc
19 |
20 | ch02: CXXFLAGS += -DNDEBUG #使用sleep函数不得不让assert失效
21 | ch02: ch02.cc
22 |
23 | ch05: ch05.cc
24 |
25 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s13_epoll/Timer.cc:
--------------------------------------------------------------------------------
1 | // excerpts from http://code.google.com/p/muduo/
2 | //
3 | // Use of this source code is governed by a BSD-style license
4 | // that can be found in the License file.
5 | //
6 | // Author: Shuo Chen (chenshuo at chenshuo dot com)
7 |
8 | #include "Timer.h"
9 |
10 | using namespace muduo;
11 |
12 | AtomicInt64 Timer::s_numCreated_;
13 |
14 | void Timer::restart(Timestamp now)
15 | {
16 | if (repeat_)
17 | {
18 | expiration_ = addTime(now, interval_);
19 | }
20 | else
21 | {
22 | expiration_ = Timestamp::invalid();
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s11_Connector/Timer.cc:
--------------------------------------------------------------------------------
1 | // excerpts from http://code.google.com/p/muduo/
2 | //
3 | // Use of this source code is governed by a BSD-style license
4 | // that can be found in the License file.
5 | //
6 | // Author: Shuo Chen (chenshuo at chenshuo dot com)
7 |
8 | #include "Timer.h"
9 |
10 | using namespace muduo;
11 |
12 | AtomicInt64 Timer::s_numCreated_;
13 |
14 | void Timer::restart(Timestamp now)
15 | {
16 | if (repeat_)
17 | {
18 | expiration_ = addTime(now, interval_);
19 | }
20 | else
21 | {
22 | expiration_ = Timestamp::invalid();
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s12_TcpClient/Timer.cc:
--------------------------------------------------------------------------------
1 | // excerpts from http://code.google.com/p/muduo/
2 | //
3 | // Use of this source code is governed by a BSD-style license
4 | // that can be found in the License file.
5 | //
6 | // Author: Shuo Chen (chenshuo at chenshuo dot com)
7 |
8 | #include "Timer.h"
9 |
10 | using namespace muduo;
11 |
12 | AtomicInt64 Timer::s_numCreated_;
13 |
14 | void Timer::restart(Timestamp now)
15 | {
16 | if (repeat_)
17 | {
18 | expiration_ = addTime(now, interval_);
19 | }
20 | else
21 | {
22 | expiration_ = Timestamp::invalid();
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Using_STL/Checkout/Checkout_up/Customer.h:
--------------------------------------------------------------------------------
1 | // Defines a customer by their time to checkout
2 | #ifndef CUSTOMER_H
3 | #define CUSTOMER_H
4 |
5 | class Customer
6 | {
7 | private:
8 | size_t checkout_t_ {}; // Time to checkout
9 |
10 | public:
11 | explicit Customer(size_t st = 10) :checkout_t_{st}{}
12 |
13 | // Decrement time remaining to checkout
14 | Customer& time_decrement()
15 | {
16 | --checkout_t_;
17 | return *this;
18 | }
19 | bool done() { return checkout_t_ == 0; }
20 | };
21 | #endif
22 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s13_epoll/test12.cc:
--------------------------------------------------------------------------------
1 | #include "Connector.h"
2 | #include "EventLoop.h"
3 |
4 | #include
5 |
6 | muduo::EventLoop* g_loop;
7 |
8 | void connectCallback(int sockfd)
9 | {
10 | printf("connected.\n");
11 | g_loop->quit();
12 | }
13 |
14 | int main(int argc, char* argv[])
15 | {
16 | muduo::EventLoop loop;
17 | g_loop = &loop;
18 | muduo::InetAddress addr("127.0.0.1", 9981);
19 | muduo::ConnectorPtr connector(new muduo::Connector(&loop, addr));
20 | connector->setNewConnectionCallback(connectCallback);
21 | connector->start();
22 |
23 | loop.loop();
24 | }
25 |
--------------------------------------------------------------------------------
/Fluent_Python/ch14-it-generator/sentence/class/sentence_gen.py:
--------------------------------------------------------------------------------
1 | """
2 | Sentence: iterate over words using a generator function
3 | """
4 |
5 | import re
6 | import reprlib
7 |
8 | RE_WORD = re.compile('\w+')
9 |
10 |
11 | class Sentence:
12 |
13 | def __init__(self, text):
14 | self.text = text
15 | self.words = RE_WORD.findall(text)
16 |
17 | def __repr__(self):
18 | return 'Sentence(%s)' % reprlib.repr(self.text)
19 |
20 | def __iter__(self):
21 | for word in self.words: # <1>
22 | yield word # <2>
23 | return # <3>
24 |
25 | # done! <4>
26 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch01-moderner_and_simpler/1-10_init_narrow.cc:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main(void)
4 | {
5 | int a = 1.1;
6 | //int b = { 1.1 }; //error
7 |
8 | float fa = 1e40;
9 | //float fb = { 1e40 }; //error
10 |
11 | float fc = (unsigned long long)-1;
12 | //float fd = { (unsigned long long)-1 }; //error
13 | float fe = (unsigned long long)1;
14 | float ff = { (unsigned long long)1 }; //OK
15 |
16 | const int x = 1024;
17 | const int y = 1;
18 |
19 | char c = x;
20 | //char d = { x }; //error
21 | char e = y;
22 | char f = { y };
23 |
24 | system("pause");
25 | return 0;
26 | }
27 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s11_Connector/test12.cc:
--------------------------------------------------------------------------------
1 | #include "Connector.h"
2 | #include "EventLoop.h"
3 |
4 | #include
5 |
6 | muduo::EventLoop* g_loop;
7 |
8 | void connectCallback(int sockfd)
9 | {
10 | printf("connected.\n");
11 | g_loop->quit();
12 | }
13 |
14 | int main(int argc, char* argv[])
15 | {
16 | muduo::EventLoop loop;
17 | g_loop = &loop;
18 | muduo::InetAddress addr("127.0.0.1", 9981);
19 | muduo::ConnectorPtr connector(new muduo::Connector(&loop, addr));
20 | connector->setNewConnectionCallback(connectCallback);
21 | connector->start();
22 |
23 | loop.loop();
24 | }
25 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s13_epoll/test1.cc:
--------------------------------------------------------------------------------
1 | #include "EventLoop.h"
2 | #include
3 | #include
4 |
5 | void threadFunc()
6 | {
7 | printf("threadFunc(): pid = %d, tid = %d\n",
8 | getpid(), muduo::CurrentThread::tid());
9 |
10 | muduo::EventLoop loop;
11 | loop.loop();
12 | }
13 |
14 | int main()
15 | {
16 | printf("main(): pid = %d, tid = %d\n",
17 | getpid(), muduo::CurrentThread::tid());
18 |
19 | muduo::EventLoop loop;
20 |
21 | muduo::Thread thread(threadFunc);
22 | thread.start();
23 |
24 | loop.loop();
25 | pthread_exit(NULL);
26 | }
27 |
--------------------------------------------------------------------------------
/Fluent_Python/ch14-it-generator/sentence/class/sentence_getitem.py:
--------------------------------------------------------------------------------
1 | """
2 | Sentence: access words by index
3 | """
4 |
5 | import re
6 | import reprlib
7 |
8 | RE_WORD = re.compile('\w+')
9 |
10 |
11 | class Sentence:
12 |
13 | def __init__(self, text):
14 | self.text = text
15 | self.words = RE_WORD.findall(text) # <1>
16 |
17 | def __getitem__(self, index):
18 | return self.words[index] # <2>
19 |
20 | def __len__(self, index): # <3>
21 | return len(self.words)
22 |
23 | def __repr__(self):
24 | return 'Sentence(%s)' % reprlib.repr(self.text) # <4>
25 |
26 |
--------------------------------------------------------------------------------
/Fluent_Python/ch14-it-generator/soapbox/yield_delegate/yield_delegate_fix.py:
--------------------------------------------------------------------------------
1 | """ Example adapted from ``yield_delegate_fail.py``
2 |
3 | The following program performs a simple abstraction over the process of
4 | yielding.
5 |
6 | """
7 |
8 | # BEGIN YIELD_DELEGATE_FIX
9 | def f():
10 | def do_yield(n):
11 | yield n
12 | x = 0
13 | while True:
14 | x += 1
15 | yield from do_yield(x)
16 | # END YIELD_DELEGATE_FIX
17 |
18 | if __name__ == '__main__':
19 | print('Invoking f() now produces a generator')
20 | g = f()
21 | print(next(g))
22 | print(next(g))
23 | print(next(g))
24 |
25 |
--------------------------------------------------------------------------------
/Fluent_Python/ch18b-async-await/README.rst:
--------------------------------------------------------------------------------
1 | Refactored sample code for Chapter 18 - "Concurrency with asyncio"
2 |
3 | From the book "Fluent Python" by Luciano Ramalho (O'Reilly, 2015)
4 | http://shop.oreilly.com/product/0636920032519.do
5 |
6 | ##################################################################
7 | NOTE: this "18b" directory contains the examples of chapter 18
8 | rewritten using the new async/await syntax available in Python 3.5
9 | ONLY, instead of the "yield-from" syntax which works since Python
10 | 3.3 (and will still work with Python 3.5).
11 | ##################################################################
12 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch05-thread/5-6/5-6/Test.cpp:
--------------------------------------------------------------------------------
1 | #include "SimpleSyncQueue.hpp"
2 |
3 | #include
4 | #include
5 |
6 | SimpleSyncQueue syncQueue;
7 |
8 | void PutDatas()
9 | {
10 | for (int i = 0; i < 20; ++i)
11 | {
12 | syncQueue.Put(888);
13 | }
14 | }
15 |
16 | void TakeDatas()
17 | {
18 | int x = 0;
19 |
20 | for (int i = 0; i < 20; ++i)
21 | {
22 | syncQueue.Take(x);
23 | std::cout << x << std::endl;
24 | }
25 | }
26 |
27 | int main(void)
28 | {
29 | std::thread t1(PutDatas);
30 | std::thread t2(TakeDatas);
31 |
32 | t1.join();
33 | t2.join();
34 |
35 | system("pause");
36 | return 0;
37 | }
--------------------------------------------------------------------------------
/Using_STL/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. # -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = #-lpthread
3 | BASE_SRC =
4 | LIB_SRC =
5 | BINARIES = ch01 ch06 ch07 ch09 ch10
6 | HEADERS=$(wildcard *.h)
7 |
8 | all: $(BINARIES)
9 | $(BINARIES): $(HEADERS)
10 | $(BINARIES):
11 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
12 |
13 | clean:
14 | rm -f $(BINARIES) core
15 |
16 |
17 | ch01: CXXFLAGS += -Wall
18 | ch01: ch01.cc
19 |
20 | ch06: ch06.cc
21 |
22 | ch07: ch07.cc
23 |
24 | ch09: ch09.cc
25 |
26 | ch09_cin: ch09_cin.cc
27 |
28 | ch10: ch10.cc
29 |
30 | ch10_gaussion: ch10_gaussion.cc
31 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s04_Acceptor/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g -pthread #-I ../.. -g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread -lmuduo_net -lmuduo_base
3 | BASE_SRC =
4 | LIB_SRC = EventLoop.cc \
5 | Poller.cc Channel.cc \
6 | Timer.cc TimerQueue.cc EventLoopThread.cc \
7 | Acceptor.cc Socket.cc SocketsOps.cc InetAddress.cc # s04
8 | BINARIES = test7
9 | HEADERS=$(wildcard *.h)
10 |
11 | all: $(BINARIES)
12 | $(BINARIES): $(HEADERS)
13 | $(BINARIES):
14 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
15 |
16 | clean:
17 | rm -f $(BINARIES) core
18 |
19 | test7: test7.cc # s04
20 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch01-moderner_and_simpler/1-05_template.cc:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | template
5 | class Foo
6 | {
7 | //typename ContainerT::iterator it_; //类型定义可能有问题
8 | //若想在 const ContainerT 下通过编译请使用下面it_定义:
9 | decltype(std::declval().begin()) it_;
10 | public:
11 | void func(ContainerT& container)
12 | {
13 | it_ = container.begin();
14 | }
15 |
16 | //...
17 | };
18 |
19 | int main(void)
20 | {
21 | typedef const std::vector container_t; //这里有const属性,编译会报一大堆错误信息
22 | container_t arr;
23 |
24 | Foo foo;
25 | foo.func(arr);
26 |
27 | return 0;
28 | }
29 |
--------------------------------------------------------------------------------
/Fluent_Python/ch04-text-byte/default_encodings.py:
--------------------------------------------------------------------------------
1 | import sys, locale
2 |
3 | expressions = """
4 | locale.getpreferredencoding()
5 | type(my_file)
6 | my_file.encoding
7 | sys.stdout.isatty()
8 | sys.stdout.encoding
9 | sys.stdin.isatty()
10 | sys.stdin.encoding
11 | sys.stderr.isatty()
12 | sys.stderr.encoding
13 | sys.getdefaultencoding()
14 | sys.getfilesystemencoding()
15 | """
16 |
17 | my_file = open('dummy', 'w')
18 |
19 | for expression in expressions.split():
20 | value = eval(expression)
21 | print(expression.rjust(30), '->', repr(value))
22 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch05-thread/5-5/5-5/Test.cpp:
--------------------------------------------------------------------------------
1 | #include "SyncQueue.hpp"
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | SyncQueue syncQueue(5);
8 |
9 | void PutDatas()
10 | {
11 | for (int i = 0; i < 20; ++i)
12 | {
13 | syncQueue.Put(888);
14 | }
15 | }
16 |
17 | void TakeDatas()
18 | {
19 | int x = 0;
20 |
21 | for (int i = 0; i < 20; ++i)
22 | {
23 | syncQueue.Take(x);
24 | std::cout << x << std::endl;
25 | }
26 | }
27 |
28 | int main(void)
29 | {
30 | std::thread t1(PutDatas);
31 | std::thread t2(TakeDatas);
32 |
33 | t1.join();
34 | t2.join();
35 |
36 | system("pause");
37 | return 0;
38 | }
--------------------------------------------------------------------------------
/In-depth_C++11/ch01-moderner_and_simpler/1-24.cc:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | class CountEven
6 | {
7 | int& count_;
8 |
9 | public:
10 | CountEven(int& count) : count_(count){}
11 |
12 | void operator()(int val)
13 | {
14 | if (!(val & 1)) //val % 2 == 0
15 | {
16 | ++count_;
17 | }
18 | }
19 | };
20 |
21 |
22 | int main(void)
23 | {
24 | std::vector v = { 1, 2, 3, 4, 5, 6 };
25 | int even_count = 0;
26 |
27 | std::for_each(v.begin(), v.end(), CountEven(even_count));
28 | std::cout << "The number of even is " << even_count << std::endl;
29 |
30 | system("pause");
31 | return 0;
32 | }
--------------------------------------------------------------------------------
/Fluent_Python/ch21-class-metaprog/evalsupport.py:
--------------------------------------------------------------------------------
1 | print('<[100]> evalsupport module start')
2 |
3 | def deco_alpha(cls):
4 | print('<[200]> deco_alpha')
5 |
6 | def inner_1(self):
7 | print('<[300]> deco_alpha:inner_1')
8 |
9 | cls.method_y = inner_1
10 | return cls
11 |
12 |
13 | class MetaAleph(type):
14 | print('<[400]> MetaAleph body')
15 |
16 | def __init__(cls, name, bases, dic):
17 | print('<[500]> MetaAleph.__init__')
18 |
19 | def inner_2(self):
20 | print('<[600]> MetaAleph.__init__:inner_2')
21 |
22 | cls.method_z = inner_2
23 |
24 |
25 | print('<[700]> evalsupport module end')
26 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s00_EventLoop/test1.cc:
--------------------------------------------------------------------------------
1 | #include "EventLoop.h"
2 | #include
3 | #include
4 | #include // getpid()
5 |
6 | void threadFunc()
7 | {
8 | printf("threadFunc(): pid = %d, tid = %d\n",
9 | getpid(), muduo::CurrentThread::tid());
10 |
11 | muduo::EventLoop loop;
12 | loop.loop();
13 | }
14 |
15 | int main()
16 | {
17 | printf("main(): pid = %d, tid = %d\n",
18 | getpid(), muduo::CurrentThread::tid());
19 |
20 | muduo::EventLoop loop;
21 |
22 | muduo::Thread thread(threadFunc);
23 | thread.start();
24 |
25 | loop.loop();
26 | pthread_exit(NULL);
27 | }
28 |
--------------------------------------------------------------------------------
/Fluent_Python/ch07-deco-closure/registration.py:
--------------------------------------------------------------------------------
1 | # BEGIN REGISTRATION
2 |
3 | registry = [] # <1>
4 |
5 | def register(func): # <2>
6 | print('running register(%s)' % func) # <3>
7 | registry.append(func) # <4>
8 | return func # <5>
9 |
10 | @register # <6>
11 | def f1():
12 | print('running f1()')
13 |
14 | @register
15 | def f2():
16 | print('running f2()')
17 |
18 | def f3(): # <7>
19 | print('running f3()')
20 |
21 | def main(): # <8>
22 | print('running main()')
23 | print('registry ->', registry)
24 | f1()
25 | f2()
26 | f3()
27 |
28 | if __name__=='__main__':
29 | main() # <9>
30 |
31 | # END REGISTRATION
--------------------------------------------------------------------------------
/Fluent_Python/ch11-iface-abc/tombola_class/tombolist.py:
--------------------------------------------------------------------------------
1 | from random import randrange
2 |
3 | from tombola_class.tombola import Tombola
4 |
5 | @Tombola.register # <1>
6 | class TomboList(list): # <2>
7 |
8 | def pick(self):
9 | if self: # <3>
10 | position = randrange(len(self))
11 | return self.pop(position) # <4>
12 | else:
13 | raise LookupError('pop from empty TomboList')
14 |
15 | load = list.extend # <5>
16 |
17 | def loaded(self):
18 | return bool(self) # <6>
19 |
20 | def inspect(self):
21 | return tuple(sorted(self))
22 |
23 | # Tombola.register(TomboList) # <7>
24 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch01-moderner_and_simpler/1-22.cc:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | class A
5 | {
6 | public:
7 | int i_ = 0;
8 |
9 | void output(int x, int y)
10 | {
11 | std::cout << x << " " << y << std::endl;
12 | }
13 | };
14 |
15 | int main(void)
16 | {
17 | A a;
18 | std::function fr =
19 | std::bind(&A::output, &a, std::placeholders::_1, std::placeholders::_2);
20 | fr(1, 2); //输出 1 2
21 |
22 | std::function fr_i = std::bind(&A::i_, &a); //vs13的bug,绑定成员变量要报错
23 | fr_i();
24 | fr_i() = 123;
25 |
26 | std::cout << a.i_ << std::endl; //输出 123
27 |
28 | system("pause");
29 | return 0;
30 | }
31 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s02_TimerQueue/Callbacks.h:
--------------------------------------------------------------------------------
1 | // excerpts from http://code.google.com/p/muduo/
2 | //
3 | // Use of this source code is governed by a BSD-style license
4 | // that can be found in the License file.
5 | //
6 | // Author: Shuo Chen (chenshuo at chenshuo dot com)
7 |
8 | #ifndef MUDUO_NET_CALLBACKS_H
9 | #define MUDUO_NET_CALLBACKS_H
10 |
11 | #include
12 | #include
13 |
14 | #include
15 |
16 | namespace muduo
17 | {
18 |
19 | // All client visible callbacks go here.
20 |
21 | typedef boost::function TimerCallback;
22 |
23 | }
24 |
25 | #endif // MUDUO_NET_CALLBACKS_H
26 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s03_runInLoop/Callbacks.h:
--------------------------------------------------------------------------------
1 | // excerpts from http://code.google.com/p/muduo/
2 | //
3 | // Use of this source code is governed by a BSD-style license
4 | // that can be found in the License file.
5 | //
6 | // Author: Shuo Chen (chenshuo at chenshuo dot com)
7 |
8 | #ifndef MUDUO_NET_CALLBACKS_H
9 | #define MUDUO_NET_CALLBACKS_H
10 |
11 | #include
12 | #include
13 |
14 | #include
15 |
16 | namespace muduo
17 | {
18 |
19 | // All client visible callbacks go here.
20 |
21 | typedef boost::function TimerCallback;
22 |
23 | }
24 |
25 | #endif // MUDUO_NET_CALLBACKS_H
26 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s04_Acceptor/Callbacks.h:
--------------------------------------------------------------------------------
1 | // excerpts from http://code.google.com/p/muduo/
2 | //
3 | // Use of this source code is governed by a BSD-style license
4 | // that can be found in the License file.
5 | //
6 | // Author: Shuo Chen (chenshuo at chenshuo dot com)
7 |
8 | #ifndef MUDUO_NET_CALLBACKS_H
9 | #define MUDUO_NET_CALLBACKS_H
10 |
11 | #include
12 | #include
13 |
14 | #include
15 |
16 | namespace muduo
17 | {
18 |
19 | // All client visible callbacks go here.
20 |
21 | typedef boost::function TimerCallback;
22 |
23 | }
24 |
25 | #endif // MUDUO_NET_CALLBACKS_H
26 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s13_epoll/test6.cc:
--------------------------------------------------------------------------------
1 | #include "EventLoop.h"
2 | #include "EventLoopThread.h"
3 | #include
4 |
5 | void runInThread()
6 | {
7 | printf("runInThread(): pid = %d, tid = %d\n",
8 | getpid(), muduo::CurrentThread::tid());
9 | }
10 |
11 | int main()
12 | {
13 | printf("main(): pid = %d, tid = %d\n",
14 | getpid(), muduo::CurrentThread::tid());
15 |
16 | muduo::EventLoopThread loopThread;
17 | muduo::EventLoop* loop = loopThread.startLoop();
18 | loop->runInLoop(runInThread);
19 | sleep(1);
20 | loop->runAfter(2, runInThread);
21 | sleep(3);
22 | loop->quit();
23 |
24 | printf("exit main().\n");
25 | }
26 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch05-thread/5-1/5-1/Test.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 |
6 | std::mutex g_lock;
7 |
8 | void func()
9 | {
10 | g_lock.lock();
11 |
12 | std::cout << "entered thread " << std::this_thread::get_id() << std::endl;
13 | std::this_thread::sleep_for(std::chrono::seconds(1));
14 | std::cout << "leaving thread " << std::this_thread::get_id() << std::endl;
15 |
16 | g_lock.unlock();
17 | }
18 |
19 | int main(void)
20 | {
21 | std::thread t1(func);
22 | std::thread t2(func);
23 | std::thread t3(func);
24 |
25 | t1.join();
26 | t2.join();
27 | t3.join();
28 |
29 | system("pause");
30 | return 0;
31 | }
--------------------------------------------------------------------------------
/In-depth_C++11/ch05-thread/5-2/5-2/Test.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | struct Complex
6 | {
7 | std::mutex mutex;
8 | int i;
9 |
10 | Complex() : i(0){}
11 |
12 | void mul(int x)
13 | {
14 | std::lock_guard lock(mutex);
15 | i *= x;
16 | }
17 |
18 | void div(int x)
19 | {
20 | std::lock_guard lock(mutex);
21 | i /= x;
22 | }
23 |
24 | void both(int x, int y)
25 | {
26 | std::lock_guard lock(mutex);
27 | mul(x);
28 | div(y);
29 | }
30 | };
31 |
32 | int main(void)
33 | {
34 | Complex complex;
35 |
36 | complex.both(32, 23);
37 |
38 | system("pause");
39 | return 0;
40 | }
--------------------------------------------------------------------------------
/In-depth_C++11/ch06-chrono_and_convert/6-3.cc:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 |
7 | int main(void)
8 | {
9 | std::wstring str = L"我是中国人yzb";
10 | std::wstring_convert>
11 | converter(new std::codecvt());
12 |
13 | std::string narrowStr = converter.to_bytes(str);
14 |
15 | std::wstring wstr = converter.from_bytes(narrowStr);
16 | std::cout << narrowStr << std::endl;
17 |
18 | std::wcout.imbue(std::locale("chs")); //初始化cout为中文输出
19 | std::wcout << wstr << std::endl;
20 |
21 | system("pause");
22 | return 0;
23 | }
24 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s05_TcpConnection/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g -pthread #-I ../.. -g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread -lmuduo_net -lmuduo_base
3 | BASE_SRC =
4 | LIB_SRC = EventLoop.cc \
5 | Poller.cc Channel.cc \
6 | Timer.cc TimerQueue.cc EventLoopThread.cc \
7 | Acceptor.cc Socket.cc SocketsOps.cc InetAddress.cc \
8 | TcpConnection.cc TcpServer.cc # s05
9 | BINARIES = test8
10 | HEADERS=$(wildcard *.h)
11 |
12 | all: $(BINARIES)
13 | $(BINARIES): $(HEADERS)
14 | $(BINARIES):
15 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
16 |
17 | clean:
18 | rm -f $(BINARIES) core
19 |
20 | test8: test8.cc # s05
21 |
--------------------------------------------------------------------------------
/Using_STL/Checkout/Checkout_object/Customer.h:
--------------------------------------------------------------------------------
1 | // Defines a customer by their time to checkout
2 | #ifndef CUSTOMER_H
3 | #define CUSTOMER_H
4 |
5 | class Customer
6 | {
7 | protected:
8 | size_t service_t {}; // Time to checkout
9 | public:
10 | //explicit Customer(size_t st = 10) :service_t {st}{}
11 | explicit Customer(size_t st = 10) {
12 | service_t = st;
13 | }
14 |
15 | // Decrement time remaining to checkout
16 | Customer& time_decrement()
17 | {
18 | if (service_t > 0)
19 | --service_t;
20 | return *this;
21 | }
22 |
23 | bool done() const { return service_t == 0; }
24 | };
25 | #endif
26 |
--------------------------------------------------------------------------------
/Fluent_Python/ch14-it-generator/aritprog/class/aritprog_v0.py:
--------------------------------------------------------------------------------
1 | """
2 | Arithmetic progression class
3 |
4 | >>> ap = ArithmeticProgression(1, .5, 3)
5 | >>> list(ap)
6 | [1.0, 1.5, 2.0, 2.5]
7 |
8 |
9 | """
10 |
11 |
12 | class ArithmeticProgression:
13 |
14 | def __init__(self, begin, step, end=None):
15 | self.begin = begin
16 | self.step = step
17 | self.end = end # None -> "infinite" series
18 |
19 | def __iter__(self):
20 | result = type(self.begin + self.step)(self.begin)
21 | forever = self.end is None
22 | while forever or result < self.end:
23 | yield result
24 | result += self.step
25 |
--------------------------------------------------------------------------------
/Effective_Modern_Cpp/Item22-Pimp_Idiom/widget.h:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | //unique_ptr.h:76:22: error: invalid application of ‘sizeof’ to incomplete type ‘Widget::Impl’
4 | //error产生的根源: “编译器产生的”析构函数,在析构之前,需要销毁被pImpl指向的对象,但是在Widget的头文件中,pImpl指向一个不完整类型。
5 | //error产生的根源: “编译器产生的” operator move 在重新赋值前,需要销毁被pImpl指向的对象,但是在Widget的头文件中,pImpl指向一个不完整类型。
6 | class Widget{
7 | public:
8 | Widget();
9 | //...
10 | ~Widget(); // 为了消除siezof error,避免内联, 声明和实现析构函数必须分离, 则可以防止static_assert出错
11 | //~Widget(){} //声明+定义~Widget()依然报sizeof error错.
12 |
13 | private:
14 | struct Impl; //前置申明
15 | std::unique_ptr pImpl;// 使用智能指针来替换原始指针
16 | };
17 |
--------------------------------------------------------------------------------
/Fluent_Python/ch19-dyn-attr-prop/oscon/demo_schedule2.py:
--------------------------------------------------------------------------------
1 | import shelve
2 |
3 | from schedule2 import DB_NAME, CONFERENCE, load_db
4 | from schedule2 import DbRecord, Event
5 |
6 | with shelve.open(DB_NAME) as db:
7 | if CONFERENCE not in db:
8 | load_db(db)
9 |
10 | DbRecord.set_db(db)
11 | event = DbRecord.fetch('event.33950')
12 | print(event)
13 | print(event.venue)
14 | print(event.venue.name)
15 | for spkr in event.speakers:
16 | print('{0.serial}: {0.name}'.format(spkr))
17 |
18 | print(repr(Event.venue))
19 |
20 | event2 = DbRecord.fetch('event.33451')
21 | print(event2)
22 | print(event2.fetch)
23 | print(event2.venue)
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s06_TcpConnection/Makefile:
--------------------------------------------------------------------------------
1 | #make -B 强制重新make
2 | CXXFLAGS = -O0 -g -pthread #-I ../.. -g3可以让gdb展开宏, print命令
3 | LDFLAGS = -lpthread -lmuduo_net -lmuduo_base
4 | BASE_SRC =
5 | LIB_SRC = EventLoop.cc \
6 | Poller.cc Channel.cc \
7 | Timer.cc TimerQueue.cc EventLoopThread.cc \
8 | Acceptor.cc Socket.cc SocketsOps.cc InetAddress.cc \
9 | TcpConnection.cc TcpServer.cc # s05 s06
10 | BINARIES = test8
11 | HEADERS=$(wildcard *.h)
12 |
13 | all: $(BINARIES)
14 | $(BINARIES): $(HEADERS)
15 | $(BINARIES):
16 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
17 |
18 | clean:
19 | rm -f $(BINARIES) core
20 |
21 | test8: test8.cc
22 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-1.cc:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | template
6 | struct Construct
7 | {
8 | typedef typename std::remove_reference::type U;
9 | Construct() : m_ptr(new U){}
10 |
11 | typename std::add_lvalue_reference::type Get() const
12 | {
13 | *m_ptr = 100; //特意加的一行,以防*m_ptr是个未定义的值
14 | return *m_ptr.get();
15 | }
16 |
17 | private:
18 | typename std::unique_ptr m_ptr;
19 | };
20 |
21 | int main(void)
22 | {
23 | //typename Construct c;//error: typename只能用在模板函数、模板类中
24 | Construct c;
25 | int a = c.Get();
26 |
27 | std::cout << a << std::endl;
28 |
29 | system("pause");
30 | return 0;
31 | }
32 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s08_send/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g -pthread #-I ../.. -g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread -lmuduo_net -lmuduo_base
3 | BASE_SRC =
4 | LIB_SRC = EventLoop.cc \
5 | Poller.cc Channel.cc \
6 | Timer.cc TimerQueue.cc EventLoopThread.cc \
7 | Acceptor.cc Socket.cc SocketsOps.cc InetAddress.cc \
8 | TcpConnection.cc TcpServer.cc \
9 | Buffer.cc # s07
10 | BINARIES = test9 test10
11 | HEADERS=$(wildcard *.h)
12 |
13 | all: $(BINARIES)
14 | $(BINARIES): $(HEADERS)
15 | $(BINARIES):
16 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
17 |
18 | clean:
19 | rm -f $(BINARIES) core
20 |
21 | test9: test9.cc
22 | test10: test10.cc
23 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s03_runInLoop/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g3 -I ../.. -pthread #-g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread -lmuduo_net -lmuduo_base
3 | BASE_SRC =
4 | LIB_SRC = EventLoop.cc \
5 | Poller.cc Channel.cc \
6 | Timer.cc TimerQueue.cc EventLoopThread.cc # s03
7 | BINARIES = test5 test6
8 | HEADERS=$(wildcard *.h)
9 |
10 | all: $(BINARIES)
11 | $(BINARIES): $(HEADERS)
12 | $(BINARIES):
13 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
14 |
15 | clean:
16 | rm -f $(BINARIES) core
17 |
18 |
19 |
20 | test1: test1.cc
21 | test2: test2.cc
22 |
23 | test3: test3.cc
24 |
25 | test4: test4.cc
26 |
27 | test5: test5.cc # s03
28 | test6: test6.cc # s03
29 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s07_Buffer/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g -pthread #-I ../.. -g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread -lmuduo_net -lmuduo_base
3 | BASE_SRC =
4 | LIB_SRC = EventLoop.cc \
5 | Poller.cc Channel.cc \
6 | Timer.cc TimerQueue.cc EventLoopThread.cc \
7 | Acceptor.cc Socket.cc SocketsOps.cc InetAddress.cc \
8 | TcpConnection.cc TcpServer.cc \
9 | Buffer.cc # s07
10 | BINARIES = test3 test8
11 | HEADERS=$(wildcard *.h)
12 |
13 | all: $(BINARIES)
14 | $(BINARIES): $(HEADERS)
15 | $(BINARIES):
16 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
17 |
18 | clean:
19 | rm -f $(BINARIES) core
20 |
21 |
22 |
23 | test3: test3.cc
24 | test8: test8.cc
25 |
--------------------------------------------------------------------------------
/Fluent_Python/ch07-deco-closure/registration_param.py:
--------------------------------------------------------------------------------
1 | # BEGIN REGISTRATION_PARAM
2 |
3 | registry = set() # <1>
4 |
5 | def register(active=True): # <2>
6 | def decorate(func): # <3>
7 | print('running register(active=%s)->decorate(%s)'
8 | % (active, func))
9 | if active: # <4>
10 | registry.add(func)
11 | else:
12 | registry.discard(func) # <5>
13 |
14 | return func # <6>
15 | return decorate # <7>
16 |
17 | @register(active=False) # <8>
18 | def f1():
19 | print('running f1()')
20 |
21 | @register() # <9>
22 | def f2():
23 | print('running f2()')
24 |
25 | def f3():
26 | print('running f3()')
27 |
28 | # END REGISTRATION_PARAM
29 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/mkdiff.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # 产生命令文本的脚本, 列出所有的需要diff文件列表
4 | # 使用方法./mkdiff.sh
5 |
6 | diff_a_file()
7 | {
8 | diff $1 $2 -q |grep differ |grep -v Makefile|grep -v un~ \
9 | |awk '{\
10 | split($2, old, "/"); \
11 | split($4, new, "/"); \
12 | print "diff -U200", $2, $4, "| awk \" NR>3 {print}\" >", new[1]"-"old[1]"-"new[2]".diff"\
13 | }'
14 | echo
15 | }
16 |
17 | diff_a_file s00 s01
18 | diff_a_file s01 s02
19 | diff_a_file s02 s03
20 | diff_a_file s03 s04
21 | diff_a_file s04 s05
22 | diff_a_file s05 s06
23 | diff_a_file s06 s07
24 | diff_a_file s07 s08
25 | diff_a_file s08 s09
26 | diff_a_file s09 s10
27 | diff_a_file s10 s11
28 | diff_a_file s11 s12
29 | diff_a_file s12 s13
30 |
--------------------------------------------------------------------------------
/Fluent_Python/ch20-descriptor/bulkfood/model_v4c.py:
--------------------------------------------------------------------------------
1 | # BEGIN MODEL_V4
2 | class Quantity:
3 | __counter = 0
4 |
5 | def __init__(self):
6 | cls = self.__class__
7 | prefix = cls.__name__
8 | index = cls.__counter
9 | self.storage_name = '_{}#{}'.format(prefix, index)
10 | cls.__counter += 1
11 |
12 | def __get__(self, instance, owner):
13 | if instance is None:
14 | return self
15 | else:
16 | return getattr(instance, self.storage_name)
17 |
18 | def __set__(self, instance, value):
19 | if value > 0:
20 | setattr(instance, self.storage_name, value)
21 | else:
22 | raise ValueError('value must be > 0')
23 | # END MODEL_V4
24 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch01-moderner_and_simpler/1-21.cc:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | void output(int x, int y)
5 | {
6 | std::cout << x << " " << y << std::endl;
7 | }
8 |
9 | int main(void)
10 | {
11 | std::bind(output, 1, 2)();
12 | std::bind(output, std::placeholders::_1, 2)(1);
13 | std::bind(output, 2, std::placeholders::_1)(1);
14 |
15 | //std::bind(output, 2, std::placeholders::_2)(1); //error:调用时没有第二个参数
16 |
17 | std::bind(output, 2, std::placeholders::_2)(1, 2); //输出 2 2 调用时第一个参数被吞掉了
18 |
19 | std::bind(output, std::placeholders::_1, std::placeholders::_2)(1, 2); //输出 1 2
20 | std::bind(output, std::placeholders::_2, std::placeholders::_1)(1, 2); //输出 2 1
21 |
22 |
23 | system("pause");
24 | return 0;
25 | }
26 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-9/3-9/Test.cpp:
--------------------------------------------------------------------------------
1 | #include "MyDLL.h"
2 |
3 | #include
4 | #include
5 |
6 | void TestDll()
7 | {
8 | typedef int(*pMax)(int a, int b);
9 | typedef int(*pGet)(int a);
10 |
11 | HINSTANCE hDLL = LoadLibrary("MyDll.dll");
12 | if (hDLL == nullptr)
13 | {
14 | return;
15 | }
16 |
17 | pMax Max = (pMax)GetProcAddress(hDLL, "Max");
18 | if (Max == nullptr)
19 | {
20 | return;
21 | }
22 |
23 | int ret = Max(5, 8);
24 |
25 | pGet Get = (pGet)GetProcAddress(hDLL, "Get");
26 | if (Get == nullptr)
27 | {
28 | return;
29 | }
30 |
31 | int ret2 = Get(5);
32 |
33 | FreeLibrary(hDLL);
34 | }
35 |
36 | int main(void)
37 | {
38 | TestDll();
39 |
40 | system("pause");
41 | return 0;
42 | }
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s09_SIGPIPE/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g -pthread #-I ../.. -g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread -lmuduo_net -lmuduo_base
3 | BASE_SRC =
4 | LIB_SRC = EventLoop.cc \
5 | Poller.cc Channel.cc \
6 | Timer.cc TimerQueue.cc EventLoopThread.cc \
7 | Acceptor.cc Socket.cc SocketsOps.cc InetAddress.cc \
8 | TcpConnection.cc TcpServer.cc \
9 | Buffer.cc # s07
10 | BINARIES = test9 test10 test11
11 | HEADERS=$(wildcard *.h)
12 |
13 | all: $(BINARIES)
14 | $(BINARIES): $(HEADERS)
15 | $(BINARIES):
16 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
17 |
18 | clean:
19 | rm -f $(BINARIES) core
20 |
21 |
22 |
23 | test9: test9.cc
24 | test10: test10.cc
25 | test11: test11.cc
26 |
--------------------------------------------------------------------------------
/Fluent_Python/ch16-coroutine/coroaverager/coroaverager1-prime/coroaverager1.py:
--------------------------------------------------------------------------------
1 | # BEGIN DECORATED_AVERAGER
2 | """
3 | A coroutine to compute a running average
4 | """
5 |
6 | from coroutil import coroutine # <4>
7 |
8 | @coroutine # <5> 增加了预激装饰器
9 | def averager(): # <6>
10 | total = 0.0
11 | count = 0
12 | average = None
13 | while True:
14 | term = yield average
15 | total += term
16 | count += 1
17 | average = total/count
18 | # END DECORATED_AVERAGER
19 |
20 | coro_avg = averager() # <1>
21 | from inspect import getgeneratorstate
22 | print(getgeneratorstate(coro_avg)) # <2> 'GEN_SUSPENDED'
23 | print(coro_avg.send(10)) # <3> 10.0
24 | print(coro_avg.send(30)) # 20.0
25 | print(coro_avg.send(5)) # 15.0
26 |
27 |
--------------------------------------------------------------------------------
/Fluent_Python/ch11-iface-abc/tombola_class/bingo.py:
--------------------------------------------------------------------------------
1 | # BEGIN TOMBOLA_BINGO
2 |
3 | import random
4 | from tombola_class.tombola import Tombola
5 |
6 |
7 | class BingoCage(Tombola): # <1>
8 |
9 | def __init__(self, items):
10 | self._randomizer = random.SystemRandom() # <2>
11 | self._items = []
12 | self.load(items) # <3>
13 |
14 | def load(self, items):
15 | self._items.extend(items)
16 | self._randomizer.shuffle(self._items) # <4>
17 |
18 | def pick(self): # <5>
19 | try:
20 | return self._items.pop()
21 | except IndexError:
22 | raise LookupError('pick from empty BingoCage')
23 |
24 | def __call__(self): # <7>
25 | self.pick()
26 |
27 | # END TOMBOLA_BINGO
28 |
--------------------------------------------------------------------------------
/Fluent_Python/ch13-op-overloading/bingo_addable/bingo.py:
--------------------------------------------------------------------------------
1 | # BEGIN TOMBOLA_BINGO
2 |
3 | import random
4 |
5 | from tombola import Tombola
6 |
7 |
8 | class BingoCage(Tombola): # <1>
9 |
10 | def __init__(self, items):
11 | self._randomizer = random.SystemRandom() # <2>
12 | self._items = []
13 | self.load(items) # <3>
14 |
15 | def load(self, items):
16 | self._items.extend(items)
17 | self._randomizer.shuffle(self._items) # <4>
18 |
19 | def pick(self): # <5>
20 | try:
21 | return self._items.pop()
22 | except IndexError:
23 | raise LookupError('pick from empty BingoCage')
24 |
25 | def __call__(self): # <7>
26 | self.pick()
27 |
28 | # END TOMBOLA_BINGO
29 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s12_TcpClient/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g -pthread #-I ../.. -g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread -lmuduo_net -lmuduo_base
3 | BASE_SRC =
4 | LIB_SRC = EventLoop.cc \
5 | Poller.cc Channel.cc \
6 | Timer.cc TimerQueue.cc EventLoopThread.cc \
7 | Acceptor.cc Socket.cc SocketsOps.cc InetAddress.cc \
8 | TcpConnection.cc TcpServer.cc \
9 | Buffer.cc \
10 | EventLoopThreadPool.cc \
11 | Connector.cc \
12 | TcpClient.cc # s12
13 | BINARIES = test13
14 | HEADERS=$(wildcard *.h)
15 |
16 | all: $(BINARIES)
17 | $(BINARIES): $(HEADERS)
18 | $(BINARIES):
19 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
20 |
21 | clean:
22 | rm -f $(BINARIES) core
23 |
24 | test13: test13.cc
25 |
--------------------------------------------------------------------------------
/Fluent_Python/ch01-data-model/vec.py:
--------------------------------------------------------------------------------
1 | from math import hypot
2 |
3 | class Vector:
4 | def __init__(self, x=0, y=0):
5 | self.x = x;
6 | self.y = y;
7 | def __repr__(self):
8 | #return 'Vector(%r, %r)' %(self.x, self.y)
9 | return f'Vector({self.x}, {self.y})'
10 | def __abs__(self):
11 | return hypot(self.x, self.y)
12 | def __add__(self, other):
13 | x = self.x + other.x
14 | y = self.y + other.y
15 | return Vector(x, y)
16 | def __mul__(self, scalar):
17 | return Vector(self.x*scalar, self.y*scalar)
18 | def __rmul__(self, scalar):
19 | return Vector(self.x*scalar, self.y*scalar)
20 |
21 | v1=Vector(1,2)
22 | v2 = Vector(3,4)
23 | print(v1+v2)
24 | print(v1*3)
25 | print(4*v1)
--------------------------------------------------------------------------------
/Fluent_Python/ch06-dp-1class-func/strategy_best/promotions.py:
--------------------------------------------------------------------------------
1 |
2 | def fidelity_promo(order):
3 | """5% discount for customers with 1000 or more fidelity points"""
4 | return order.total() * .05 if order.customer.fidelity >= 1000 else 0
5 |
6 |
7 | def bulk_item_promo(order):
8 | """10% discount for each LineItem with 20 or more units"""
9 | discount = 0
10 | for item in order.cart:
11 | if item.quantity >= 20:
12 | discount += item.total() * .1
13 | return discount
14 |
15 | def large_order_promo(order):
16 | """7% discount for orders with 10 or more distinct items"""
17 | distinct_items = {item.product for item in order.cart}
18 | if len(distinct_items) >= 10:
19 | return order.total() * .07
20 | return 0
21 |
--------------------------------------------------------------------------------
/Fluent_Python/ch07-deco-closure/average/average.py:
--------------------------------------------------------------------------------
1 | """
2 | >>> avg = make_averager()
3 | >>> avg(10)
4 | 10.0
5 | >>> avg(11)
6 | 10.5
7 | >>> avg(12)
8 | 11.0
9 | >>> avg.__code__.co_varnames
10 | ('new_value', 'total')
11 | >>> avg.__code__.co_freevars
12 | ('series',)
13 | >>> avg.__closure__ # doctest: +ELLIPSIS
14 | (,)
15 | >>> avg.__closure__[0].cell_contents
16 | [10, 11, 12]
17 | """
18 |
19 | DEMO = """
20 | >>> avg.__closure__
21 | (| ,)
22 | """
23 |
24 |
25 | def make_averager():
26 | series = []
27 |
28 | def averager(new_value):
29 | series.append(new_value)
30 | total = sum(series)
31 | return total/len(series)
32 |
33 | return averager
34 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s13_epoll/test7.cc:
--------------------------------------------------------------------------------
1 | #include "Acceptor.h"
2 | #include "EventLoop.h"
3 | #include "InetAddress.h"
4 | #include "SocketsOps.h"
5 | #include
6 |
7 | void newConnection(int sockfd, const muduo::InetAddress& peerAddr)
8 | {
9 | printf("newConnection(): accepted a new connection from %s\n",
10 | peerAddr.toHostPort().c_str());
11 | ::write(sockfd, "How are you?\n", 13);
12 | muduo::sockets::close(sockfd);
13 | }
14 |
15 | int main()
16 | {
17 | printf("main(): pid = %d\n", getpid());
18 |
19 | muduo::InetAddress listenAddr(9981);
20 | muduo::EventLoop loop;
21 |
22 | muduo::Acceptor acceptor(&loop, listenAddr);
23 | acceptor.setNewConnectionCallback(newConnection);
24 | acceptor.listen();
25 |
26 | loop.loop();
27 | }
28 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3-14/3-14/Test.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | struct VariantVisitor : public boost::static_visitor
6 | {
7 | void operator()(int a)
8 | {
9 | std::cout << "int" << std::endl;
10 | }
11 | void operator()(short a)
12 | {
13 | std::cout << "short" << std::endl;
14 | }
15 | void operator()(double a)
16 | {
17 | std::cout << "double" << std::endl;
18 | }
19 | void operator()(std::string a)
20 | {
21 | std::cout << "std::string" << std::endl;
22 | }
23 | };
24 |
25 |
26 | int main(void)
27 | {
28 | VariantVisitor visitor;
29 | boost::variant v = 1;
30 | boost::apply_visitor(visitor, v);
31 |
32 | system("pause");
33 | return 0;
34 | }
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s04_Acceptor/test7.cc:
--------------------------------------------------------------------------------
1 | #include "Acceptor.h"
2 | #include "EventLoop.h"
3 | #include "InetAddress.h"
4 | #include "SocketsOps.h"
5 | #include
6 |
7 | void newConnection(int sockfd, const muduo::InetAddress& peerAddr)
8 | {
9 | printf("newConnection(): accepted a new connection from %s\n",
10 | peerAddr.toHostPort().c_str());
11 | ::write(sockfd, "How are you?\n", 13);
12 | muduo::sockets::close(sockfd);
13 | }
14 |
15 | int main()
16 | {
17 | printf("main(): pid = %d\n", getpid());
18 |
19 | muduo::InetAddress listenAddr(9981);
20 | muduo::EventLoop loop;
21 |
22 | muduo::Acceptor acceptor(&loop, listenAddr);
23 | acceptor.setNewConnectionCallback(newConnection);
24 | acceptor.listen();
25 |
26 | loop.loop();
27 | }
28 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s11_Connector/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g -pthread #-I ../.. -g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread -lmuduo_net -lmuduo_base
3 | BASE_SRC =
4 | LIB_SRC = EventLoop.cc \
5 | Poller.cc Channel.cc \
6 | Timer.cc TimerQueue.cc EventLoopThread.cc \
7 | Acceptor.cc Socket.cc SocketsOps.cc InetAddress.cc \
8 | TcpConnection.cc TcpServer.cc \
9 | Buffer.cc \
10 | EventLoopThreadPool.cc \
11 | Connector.cc # s11/test12.cc
12 |
13 | BINARIES = test4 test12
14 | HEADERS=$(wildcard *.h)
15 |
16 | all: $(BINARIES)
17 | $(BINARIES): $(HEADERS)
18 | $(BINARIES):
19 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
20 |
21 | clean:
22 | rm -f $(BINARIES) core
23 |
24 | test4: test4.cc
25 | test12: test12.cc
26 |
--------------------------------------------------------------------------------
/Fluent_Python/ch12-inheritance/diamond.py:
--------------------------------------------------------------------------------
1 | class A:
2 | def ping(self):
3 | print('ping:', self)
4 |
5 |
6 | class B(A):
7 | def pong(self):
8 | print('pong:', self)
9 |
10 |
11 | class C(A):
12 | def pong(self):
13 | print('PONG:', self)
14 |
15 |
16 | class D(B, C):
17 |
18 | def ping(self):
19 | super().ping() # A.ping(self) 绕过mro,直接到达任意一个父类
20 | print('post-ping:', self)
21 |
22 | def pingpong(self):
23 | self.ping()
24 | super().ping()
25 | self.pong()
26 | super().pong()
27 | C.pong(self)
28 |
29 | if __name__ == '__main__':
30 | d = D()
31 | d.pong()
32 | C.pong(d)
33 |
34 | print(D.__mro__) # 经常查看每一个类的__mro__,分析调用优先级
35 | d.ping()
36 |
37 | d.pingpong()
38 |
39 |
--------------------------------------------------------------------------------
/Using_STL/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "tasks": [
3 | {
4 | "type": "cppbuild",
5 | "label": "C/C++: g++ build active file",
6 | "command": "/usr/bin/g++",
7 | "args": [
8 | "-g",
9 | "${file}",
10 | "-o",
11 | "${fileDirname}/${fileBasenameNoExtension}"
12 | ],
13 | "options": {
14 | "cwd": "/usr/bin"
15 | },
16 | "problemMatcher": [
17 | "$gcc"
18 | ],
19 | "group": {
20 | "kind": "build",
21 | "isDefault": true
22 | },
23 | "detail": "Generated task by Debugger"
24 | }
25 | ],
26 | "version": "2.0.0"
27 | }
--------------------------------------------------------------------------------
/Fluent_Python/ch05-1class-func/bingocall.py:
--------------------------------------------------------------------------------
1 |
2 | # BEGIN BINGO
3 |
4 | import random
5 |
6 | class BingoCage:
7 |
8 | def __init__(self, items):
9 | self._items = list(items) # <1>
10 | random.shuffle(self._items) # <2>
11 |
12 | def pick(self): # <3>
13 | try:
14 | return self._items.pop()
15 | except IndexError:
16 | raise LookupError('pick from empty BingoCage') # <4>
17 |
18 | def __call__(self): # <5>
19 | return self.pick()
20 |
21 | bingo = BingoCage(range(3))
22 |
23 | print(bingo.pick()) # 0
24 | print(bingo()) # 2
25 | print(callable(bingo)) # True
26 | print(callable(bingo())) # False
27 | print(callable(BingoCage)) # True
28 | print(callable(BingoCage( (1, 2, 4) ))) # True
29 |
30 |
31 |
32 | # END BINGO
33 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch06_sudoku/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | set -x
4 |
5 | SOURCE_DIR=`pwd`
6 | BUILD_DIR=${BUILD_DIR:-./build}
7 | BUILD_TYPE=${BUILD_TYPE:-debug}
8 | INSTALL_DIR=${INSTALL_DIR:-../${BUILD_TYPE}-install-cpp11}
9 | BUILD_NO_EXAMPLES=${BUILD_NO_EXAMPLES:-0}
10 |
11 | mkdir -p $BUILD_DIR/$BUILD_TYPE-cpp11 \
12 | && cd $BUILD_DIR/$BUILD_TYPE-cpp11 \
13 | && cp ../../req.txt . \
14 | && cmake \
15 | -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
16 | -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \
17 | -DCMAKE_BUILD_NO_EXAMPLES=$BUILD_NO_EXAMPLES \
18 | $SOURCE_DIR \
19 | && make $*
20 |
21 | # Use the following command to run all the unit tests
22 | # at the dir $BUILD_DIR/$BUILD_TYPE :
23 | # CTEST_OUTPUT_ON_FAILURE=TRUE make test
24 |
25 | # cd $SOURCE_DIR && doxygen
26 |
27 |
--------------------------------------------------------------------------------
/Fluent_Python/ch04-text-byte/ramanujan.py:
--------------------------------------------------------------------------------
1 | # BEGIN RE_DEMO
2 | import re
3 |
4 | re_numbers_str = re.compile(r'\d+') # <1>
5 | re_words_str = re.compile(r'\w+')
6 | re_numbers_bytes = re.compile(rb'\d+') # <2>
7 | re_words_bytes = re.compile(rb'\w+')
8 |
9 | text_str = ("Ramanujan saw \u0be7\u0bed\u0be8\u0bef" # <3>
10 | " as 1729 = 1³ + 12³ = 9³ + 10³.") # <4>
11 |
12 | text_bytes = text_str.encode('utf_8') # <5>
13 |
14 | print('Text', repr(text_str), sep='\n ')
15 | print('Numbers')
16 | print(' str :', re_numbers_str.findall(text_str)) # <6>
17 | print(' bytes:', re_numbers_bytes.findall(text_bytes)) # <7>
18 | print('Words')
19 | print(' str :', re_words_str.findall(text_str)) # <8>
20 | print(' bytes:', re_words_bytes.findall(text_bytes)) # <9>
21 | # END RE_DEMO
22 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch08-Pattern/8-5.cc:
--------------------------------------------------------------------------------
1 | #include
2 | #include "Observer.hpp"
3 |
4 | struct stA
5 | {
6 | int a, b;
7 | void print(int a, int b){std::cout << a << ", " << b << std::endl; }
8 | };
9 | void print(int a, int b){std::cout << a << ", " << b << std::endl; }
10 |
11 | int main(void)
12 | {
13 | Events> myevent;
14 |
15 | auto key=myevent.Connect(print);
16 | stA t;
17 | auto lambdakey = myevent.Connect([&t](int a, int b) { t.a = a; t.b= b; });
18 | // std::function registration
19 | std::functionf = std::bind(&stA::print, &t, std::placeholders::_1, std::placeholders::_2);
20 | myevent.Connect(f);
21 | int a = 1, b=2;
22 | myevent.Notify(a,b);
23 | myevent.Disconnect(key);
24 |
25 | return 0;
26 | }
27 |
28 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/enable_if.cc:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | template
4 | typename std::enable_if::value, T>::type foo(T t)
5 | {
6 | return t;
7 | }
8 |
9 | template
10 | typename std::enable_if::value, T>::type foo(T t)
11 | {
12 | return t;
13 | }
14 |
15 |
16 | template
17 | T foo2(T t, typename std::enable_if::value, int>::type =0)
18 | {
19 | return t;
20 | }
21 |
22 |
23 | int main(void)
24 | {
25 | auto r = foo(1);
26 | auto r1= foo(1.2);
27 | auto r2= foo("test");
28 |
29 | //auto r3=foo2("test",1);
30 | //auto r3=foo2(1.4, 1);
31 | auto r3=foo2(5, 1);
32 | auto r4=foo2(9, 1.4);
33 | auto r5=foo2(6);
34 | //auto r6=foo2(9, 1.4, "test");
35 | }
36 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s10_multithread/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS = -O0 -g -pthread #-I ../.. -g3可以让gdb展开宏, print命令
2 | LDFLAGS = -lpthread -lmuduo_net -lmuduo_base
3 | BASE_SRC =
4 | LIB_SRC = EventLoop.cc \
5 | Poller.cc Channel.cc \
6 | Timer.cc TimerQueue.cc EventLoopThread.cc \
7 | Acceptor.cc Socket.cc SocketsOps.cc InetAddress.cc \
8 | TcpConnection.cc TcpServer.cc \
9 | Buffer.cc \
10 | EventLoopThreadPool.cc # s10
11 | BINARIES = test8 test9 test10 test11
12 | HEADERS=$(wildcard *.h)
13 |
14 | all: $(BINARIES)
15 | $(BINARIES): $(HEADERS)
16 | $(BINARIES):
17 | g++ $(CXXFLAGS) -o $@ $(LIB_SRC) $(BASE_SRC) $(filter %.cc,$^) $(LDFLAGS)
18 |
19 | clean:
20 | rm -f $(BINARIES) core
21 |
22 |
23 |
24 | test8: test8.cc
25 | test9: test9.cc
26 | test10: test10.cc
27 | test11: test11.cc
28 |
--------------------------------------------------------------------------------
/Fluent_Python/ch11-iface-abc/tombola_class/lotto.py:
--------------------------------------------------------------------------------
1 | # BEGIN LOTTERY_BLOWER
2 |
3 | import random
4 |
5 | from tombola_class.tombola import Tombola
6 |
7 |
8 | class LotteryBlower(Tombola):
9 |
10 | def __init__(self, iterable):
11 | self._balls = list(iterable) # <1>
12 |
13 | def load(self, iterable):
14 | self._balls.extend(iterable)
15 |
16 | def pick(self):
17 | try:
18 | position = random.randrange(len(self._balls)) # <2>
19 | except ValueError:
20 | raise LookupError('pick from empty BingoCage')
21 | return self._balls.pop(position) # <3>
22 |
23 | def loaded(self): # <4>
24 | return bool(self._balls)
25 |
26 | def inspect(self): # <5>
27 | return tuple(sorted(self._balls))
28 |
29 |
30 | # END LOTTERY_BLOWER
31 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch03-type_traits_and_vargs/3.16/Test.cc:
--------------------------------------------------------------------------------
1 | #include
2 | #include "ScopeGuard.h"
3 |
4 | #include
5 | #include
6 |
7 | void TestScopeGuard()
8 | {
9 | std::function < void()> f = [](){ std::cout << "cleanup from unnormal exit" << std::endl; };
10 | //正常退出
11 | {
12 | auto gd = MakeGuard(f);
13 | //...
14 | gd.Dismiss(); //表明前面我是正常的清理了资源,属于正常退出的
15 | }
16 |
17 | //异常退出
18 | try
19 | {
20 | auto gd = MakeGuard(f);
21 | //...
22 | throw 1;
23 | }
24 | catch (...)
25 | {
26 | std::cout << "捕获到了一个异常!!\n\n";
27 | }
28 |
29 | //非正常退出
30 | {
31 | auto gd = MakeGuard(f);
32 | return; //非正常退出表示资源还没清理呢,,等着ScopeGuard自动清理
33 | //...
34 | }
35 | }
36 |
37 |
38 | int main(void)
39 | {
40 | TestScopeGuard();
41 |
42 | system("pause");
43 | return 0;
44 | }
45 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s04_Acceptor/TimerId.h:
--------------------------------------------------------------------------------
1 | // excerpts from http://code.google.com/p/muduo/
2 | //
3 | // Use of this source code is governed by a BSD-style license
4 | // that can be found in the License file.
5 | //
6 | // Author: Shuo Chen (chenshuo at chenshuo dot com)
7 |
8 | #ifndef MUDUO_NET_TIMERID_H
9 | #define MUDUO_NET_TIMERID_H
10 |
11 | #include
12 |
13 | namespace muduo
14 | {
15 |
16 | class Timer;
17 |
18 | ///
19 | /// An opaque identifier, for canceling Timer.
20 | ///
21 | class TimerId : public muduo::copyable
22 | {
23 | public:
24 | explicit TimerId(Timer* timer)
25 | : value_(timer)
26 | {
27 | }
28 |
29 | // default copy-ctor, dtor and assignment are okay
30 |
31 | private:
32 | Timer* value_;
33 | };
34 |
35 | }
36 |
37 | #endif // MUDUO_NET_TIMERID_H
38 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s07_Buffer/TimerId.h:
--------------------------------------------------------------------------------
1 | // excerpts from http://code.google.com/p/muduo/
2 | //
3 | // Use of this source code is governed by a BSD-style license
4 | // that can be found in the License file.
5 | //
6 | // Author: Shuo Chen (chenshuo at chenshuo dot com)
7 |
8 | #ifndef MUDUO_NET_TIMERID_H
9 | #define MUDUO_NET_TIMERID_H
10 |
11 | #include
12 |
13 | namespace muduo
14 | {
15 |
16 | class Timer;
17 |
18 | ///
19 | /// An opaque identifier, for canceling Timer.
20 | ///
21 | class TimerId : public muduo::copyable
22 | {
23 | public:
24 | explicit TimerId(Timer* timer)
25 | : value_(timer)
26 | {
27 | }
28 |
29 | // default copy-ctor, dtor and assignment are okay
30 |
31 | private:
32 | Timer* value_;
33 | };
34 |
35 | }
36 |
37 | #endif // MUDUO_NET_TIMERID_H
38 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s08_send/TimerId.h:
--------------------------------------------------------------------------------
1 | // excerpts from http://code.google.com/p/muduo/
2 | //
3 | // Use of this source code is governed by a BSD-style license
4 | // that can be found in the License file.
5 | //
6 | // Author: Shuo Chen (chenshuo at chenshuo dot com)
7 |
8 | #ifndef MUDUO_NET_TIMERID_H
9 | #define MUDUO_NET_TIMERID_H
10 |
11 | #include
12 |
13 | namespace muduo
14 | {
15 |
16 | class Timer;
17 |
18 | ///
19 | /// An opaque identifier, for canceling Timer.
20 | ///
21 | class TimerId : public muduo::copyable
22 | {
23 | public:
24 | explicit TimerId(Timer* timer)
25 | : value_(timer)
26 | {
27 | }
28 |
29 | // default copy-ctor, dtor and assignment are okay
30 |
31 | private:
32 | Timer* value_;
33 | };
34 |
35 | }
36 |
37 | #endif // MUDUO_NET_TIMERID_H
38 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s09_SIGPIPE/TimerId.h:
--------------------------------------------------------------------------------
1 | // excerpts from http://code.google.com/p/muduo/
2 | //
3 | // Use of this source code is governed by a BSD-style license
4 | // that can be found in the License file.
5 | //
6 | // Author: Shuo Chen (chenshuo at chenshuo dot com)
7 |
8 | #ifndef MUDUO_NET_TIMERID_H
9 | #define MUDUO_NET_TIMERID_H
10 |
11 | #include
12 |
13 | namespace muduo
14 | {
15 |
16 | class Timer;
17 |
18 | ///
19 | /// An opaque identifier, for canceling Timer.
20 | ///
21 | class TimerId : public muduo::copyable
22 | {
23 | public:
24 | explicit TimerId(Timer* timer)
25 | : value_(timer)
26 | {
27 | }
28 |
29 | // default copy-ctor, dtor and assignment are okay
30 |
31 | private:
32 | Timer* value_;
33 | };
34 |
35 | }
36 |
37 | #endif // MUDUO_NET_TIMERID_H
38 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s02_TimerQueue/TimerId.h:
--------------------------------------------------------------------------------
1 | // excerpts from http://code.google.com/p/muduo/
2 | //
3 | // Use of this source code is governed by a BSD-style license
4 | // that can be found in the License file.
5 | //
6 | // Author: Shuo Chen (chenshuo at chenshuo dot com)
7 |
8 | #ifndef MUDUO_NET_TIMERID_H
9 | #define MUDUO_NET_TIMERID_H
10 |
11 | #include
12 |
13 | namespace muduo
14 | {
15 |
16 | class Timer;
17 |
18 | ///
19 | /// An opaque identifier, for canceling Timer.
20 | ///
21 | class TimerId : public muduo::copyable
22 | {
23 | public:
24 | explicit TimerId(Timer* timer)
25 | : value_(timer)
26 | {
27 | }
28 |
29 | // default copy-ctor, dtor and assignment are okay
30 |
31 | private:
32 | Timer* value_;
33 | };
34 |
35 | }
36 |
37 | #endif // MUDUO_NET_TIMERID_H
38 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s03_runInLoop/TimerId.h:
--------------------------------------------------------------------------------
1 | // excerpts from http://code.google.com/p/muduo/
2 | //
3 | // Use of this source code is governed by a BSD-style license
4 | // that can be found in the License file.
5 | //
6 | // Author: Shuo Chen (chenshuo at chenshuo dot com)
7 |
8 | #ifndef MUDUO_NET_TIMERID_H
9 | #define MUDUO_NET_TIMERID_H
10 |
11 | #include
12 |
13 | namespace muduo
14 | {
15 |
16 | class Timer;
17 |
18 | ///
19 | /// An opaque identifier, for canceling Timer.
20 | ///
21 | class TimerId : public muduo::copyable
22 | {
23 | public:
24 | explicit TimerId(Timer* timer)
25 | : value_(timer)
26 | {
27 | }
28 |
29 | // default copy-ctor, dtor and assignment are okay
30 |
31 | private:
32 | Timer* value_;
33 | };
34 |
35 | }
36 |
37 | #endif // MUDUO_NET_TIMERID_H
38 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s05_TcpConnection/TimerId.h:
--------------------------------------------------------------------------------
1 | // excerpts from http://code.google.com/p/muduo/
2 | //
3 | // Use of this source code is governed by a BSD-style license
4 | // that can be found in the License file.
5 | //
6 | // Author: Shuo Chen (chenshuo at chenshuo dot com)
7 |
8 | #ifndef MUDUO_NET_TIMERID_H
9 | #define MUDUO_NET_TIMERID_H
10 |
11 | #include
12 |
13 | namespace muduo
14 | {
15 |
16 | class Timer;
17 |
18 | ///
19 | /// An opaque identifier, for canceling Timer.
20 | ///
21 | class TimerId : public muduo::copyable
22 | {
23 | public:
24 | explicit TimerId(Timer* timer)
25 | : value_(timer)
26 | {
27 | }
28 |
29 | // default copy-ctor, dtor and assignment are okay
30 |
31 | private:
32 | Timer* value_;
33 | };
34 |
35 | }
36 |
37 | #endif // MUDUO_NET_TIMERID_H
38 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s06_TcpConnection/TimerId.h:
--------------------------------------------------------------------------------
1 | // excerpts from http://code.google.com/p/muduo/
2 | //
3 | // Use of this source code is governed by a BSD-style license
4 | // that can be found in the License file.
5 | //
6 | // Author: Shuo Chen (chenshuo at chenshuo dot com)
7 |
8 | #ifndef MUDUO_NET_TIMERID_H
9 | #define MUDUO_NET_TIMERID_H
10 |
11 | #include
12 |
13 | namespace muduo
14 | {
15 |
16 | class Timer;
17 |
18 | ///
19 | /// An opaque identifier, for canceling Timer.
20 | ///
21 | class TimerId : public muduo::copyable
22 | {
23 | public:
24 | explicit TimerId(Timer* timer)
25 | : value_(timer)
26 | {
27 | }
28 |
29 | // default copy-ctor, dtor and assignment are okay
30 |
31 | private:
32 | Timer* value_;
33 | };
34 |
35 | }
36 |
37 | #endif // MUDUO_NET_TIMERID_H
38 |
--------------------------------------------------------------------------------
/Muduo_ChenShuo/ch08_reactor/s10_multithread/TimerId.h:
--------------------------------------------------------------------------------
1 | // excerpts from http://code.google.com/p/muduo/
2 | //
3 | // Use of this source code is governed by a BSD-style license
4 | // that can be found in the License file.
5 | //
6 | // Author: Shuo Chen (chenshuo at chenshuo dot com)
7 |
8 | #ifndef MUDUO_NET_TIMERID_H
9 | #define MUDUO_NET_TIMERID_H
10 |
11 | #include
12 |
13 | namespace muduo
14 | {
15 |
16 | class Timer;
17 |
18 | ///
19 | /// An opaque identifier, for canceling Timer.
20 | ///
21 | class TimerId : public muduo::copyable
22 | {
23 | public:
24 | explicit TimerId(Timer* timer)
25 | : value_(timer)
26 | {
27 | }
28 |
29 | // default copy-ctor, dtor and assignment are okay
30 |
31 | private:
32 | Timer* value_;
33 | };
34 |
35 | }
36 |
37 | #endif // MUDUO_NET_TIMERID_H
38 |
--------------------------------------------------------------------------------
/In-depth_C++11/ch01-moderner_and_simpler/1-17_std_function.cc:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | void func(void)
5 | {
6 | std::cout << __FUNCTION__ << std::endl;
7 | }
8 |
9 | class Foo
10 | {
11 | public:
12 | static int foo_func(int a)
13 | {
14 | std::cout << __FUNCTION__ << "(" << a << ") ->: ";
15 | return a;
16 | }
17 | };
18 |
19 | class Bar
20 | {
21 | public:
22 | int operator()(int a)
23 | {
24 | std::cout << __FUNCTION__ << "(" << a << ") ->: ";
25 | return a;
26 | }
27 | };
28 |
29 | int main(void)
30 | {
31 | std::function fr1 = func;
32 | fr1();
33 |
34 | //绑定一个类的静态成员函数
35 | std::function fr2 = Foo::foo_func;
36 | std::cout << fr2(123) << std::endl;
37 |
38 | Bar bar;
39 | fr2 = bar;
40 | std::cout << fr2(123) << std::endl;
41 |
42 | system("pause");
43 | return 0;
44 | }
--------------------------------------------------------------------------------
/In-depth_C++11/ch01-moderner_and_simpler/1-09_init.cc:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include | |