10 2015 档案
摘要:Negative Indexes(负索引) Getting Sublists with Slices • spam[2] is a list with an index (one integer).• spam[1:4] is a list with a slice (two integers).
阅读全文
摘要:MapTest.cpp#include #include #include #include #include "MapTest.h"using namespace std;void MapTest::simpleEnumeration(){ map coll { { "tim...
阅读全文
摘要:RuntimeCmp.hpp#include using namespace std;// type for runtime sorting criterionclass RuntimeCmp {public: enum cmp_mode { normal, reverse };private...
阅读全文
摘要:1. 简单的if/else条件判断 judge_flow.py 运行结果: Please input name: davidInvalid user! Please input name: masterHello MasterPlease input password: aaaWrong passw
阅读全文
摘要:MultiSet根据特定排序准则,自动将元素排序。MultiSet允许元素重复。一些常规操作:MultiSetTest.cpp#include #include #include #include #include #include "MultiSetTest.h"using namespace s...
阅读全文
摘要:Set根据特定排序准则,自动将元素排序。Set不允许元素重复。一些常规操作:SetTest.cpp#include #include #include #include #include #include "SetTest.h"using namespace std;void SetTest::op...
阅读全文
摘要:1. 什么是视图控制器(View Controller)简单来说,视图控制器用来管理你所有的视图。他们是你的视图和模型的粘合剂。如果你做过MVC的Web项目,我想你应该不会对它感到陌生。2. 视图控制器的声明周期MethodDescriptionloadView 创建并返回一个视图控制器的视图vi...
阅读全文
摘要:forward list是一个行为受限的list, 不能走回头路。它只提供前向迭代器, 而不提供双向迭代器。eg:rbegin(), rend(), crbegin(), crend()这些都不提供。它不提供size()成员函数。没有指向最末元素的anchor, 因此不提供back(), push_...
阅读全文
摘要:List内部结构完全不同于array, vector, deque。它提供了两个pointer,指向第一个和最后一个元素。不支持随机访问元素,因此要访问第n个元素必须爬过n - 1个元素。在任何位置上执行元素的插入和删除操作都很快。因此会有一些属于list的特殊类型操作,比如merge, splic...
阅读全文
摘要:Deque和Vector类似,只不过deque头尾都开放,能够在头尾进行快速插入和删除操作DequeTest.cpp#include #include #include #include #include #include "DequeTest.h"using namespace std;void ...
阅读全文
摘要:VectorTest.cpp#include #include #include #include #include #include "VectorTest.h"using namespace std;void VectorTest::simpleOperation(){ // create...
阅读全文
摘要:Array是C++ 11给STL新增加的容器ArrayTest.cpp#include #include #include #include #include "../../Core/print.hpp"#include "ArrayTest.h"using namespace std;void A...
阅读全文
摘要:服务端:hello_server.c#include #include #include #include #include #include void error_handling(char *message);int main(int argc, char *argv[]){ int se...
阅读全文
摘要:A lambda expression is an unnamed block of code (or an unnamed function) with a list of formal parameters and abody.Java8中的lambda表达式不同于C#,使用的是->eg:// ...
阅读全文
摘要:给程序加上控制台菜单menu.pyimport sysfrom notebook import Notebook, Noteclass Menu: '''Display a menu and respond to choices when run.''' def __init__(sel...
阅读全文
摘要:notebook.pyimport datetimelast_id = 0class Note: '''Represent a note in the notebook. Match against a string in searches and store tags for each...
阅读全文