1. 问题的引入——将operator*模板化 Item 24中解释了为什么对于所有参数的隐式类型转换,只有非成员函数是合格的,并且使用了一个为Rational 类创建的operator*函数作为实例。在继续之前建议你先回顾一下这个例子,因为这个条款的讨论是对它的扩展,我们会对Item 24的实例做 ...
分类:
编程语言 时间:
2017-04-11 09:37:46
阅读次数:
273
#include <bits/stdc++.h>using namespace std;struct pcb{ int id;//进程id int priority;//优先权 int status;//状态0执行1就绪2阻塞 int last;//执行所需时间 bool operator < (c ...
分类:
其他好文 时间:
2017-04-10 21:21:59
阅读次数:
167
智能指针的行为像是指针,但是没有提供加的功能。例如,Item 13中解释了如何使用标准auto_ptr和tr1::shared_ptr指针在正确的时间自动删除堆上的资源。STL容器中的迭代器基本上都是智能指针:当然,你不能通过使用“++”来将链表中的指向一个节点的内建指针移到下一个节点上去,但是li ...
分类:
编程语言 时间:
2017-04-10 09:37:47
阅读次数:
270
题意:给n(n<=100000)根棍子。每根棍子的长度是m(m<=100000),求从中任意取出三根的概率: 题解:经典FFT计数。。。枚举最长边。。然后经过一系列玄学取重就可以啦。。好神奇呀。。细节见代码。 #include<bits/stdc++.h> using namespace std; ...
分类:
其他好文 时间:
2017-04-10 09:24:26
阅读次数:
239
一、项目需求 1、根据用户名和密码,验证用户是否可登陆 2、允许一次执行可验证三次 3、当用户名输错三次后,该用户名锁定,永久不可登陆 二、代码如下 1 #!/usr/bin/env python 2 #-*- coding:utf-8 -*- 3 import operator 4 n = 0 5 ...
分类:
编程语言 时间:
2017-04-08 11:13:01
阅读次数:
201
acl语法:acl<acl_name><criterion>[flags][operator]<value>acl_name:自定义的acl名称,区分大小写,只能包含、字母、数字、"-"、"_"、":"、"."criterion:检查条件flag:标志位,例如:-i:不区分大小写operation:操作符,做数值比较,例如:eq(=)、ge(&..
分类:
其他好文 时间:
2017-04-08 01:25:40
阅读次数:
153
new operator 将对象产生与heap,不但分配内存而且为该对象调用一个constructor operator new只是分配内存,没有constructor被调用 有个一个特殊版本,称为placement new,允许从特定的内存区域分配对象 指定区域分配内存 #include <new ...
分类:
编程语言 时间:
2017-04-08 00:10:10
阅读次数:
235
1 /* ***** BEGIN LICENSE BLOCK ***** 2 * 3 * $Id: bitmap.h,v 1.3 2004/06/30 16:44:52 asuraparaju Exp $ $Name: Dirac_1_0_2 $ 4 * 5 * Version: MPL 1.1/G... ...
分类:
其他好文 时间:
2017-04-07 23:02:16
阅读次数:
292
#pragma once #pragma once #include <string> using namespace std; class gamers { public: gamers(); gamers(char c); ~gamers(); bool operator == (const g ...
分类:
其他好文 时间:
2017-04-07 22:01:38
阅读次数:
165
class A{public: typedef int (*func)(int); operator func();};int ff(int a){ return a;}A::operator func(){ return ff;}int main () { cout<< A::func(9)<<e ...
分类:
其他好文 时间:
2017-04-07 19:55:56
阅读次数:
104