public member function
std::vector::rbegin
C++98
C++11
      reverse_iterator rbegin() noexcept;
const_reverse_iterator rbegin() const noexcept;
Return reverse iterator...
                            
                            
                                分类:
其他好文   时间:
2014-08-09 23:22:42   
                                阅读次数:
684
                             
                    
                        
                            
                            
                                public member function
std::vector::front
      reference front();
const_reference front() const;
Access first element
访问第一个元素
Returns a reference to the first element in the vector....
                            
                            
                                分类:
其他好文   时间:
2014-08-09 18:45:48   
                                阅读次数:
243
                             
                    
                        
                            
                            
                                1. 接口设计1
  下面例子使用vector实现了一个栈。两个线程轮流从中弹出元素。
#include 
#include 
#include 
#include 
#include 
std::mutex myMutex;
class Stack
{
public:
    Stack() {};
    ~Stack() {};
    void pop();
    int top...
                            
                            
                                分类:
编程语言   时间:
2014-08-09 15:57:48   
                                阅读次数:
382
                             
                    
                        
                            
                            
                                1. 线程的移动语义实现
  基于前面几章介绍的移动语义,我们用它来实现线程。
#include 
#include 
#include 
#include 
#include 
int main()
{
	std::vector workers;
	for (int i = 0; i < 5; i++) {
		auto t = std::thread([i]()
		{
			std::...
                            
                            
                                分类:
移动开发   时间:
2014-08-09 11:36:27   
                                阅读次数:
276
                             
                    
                        
                            
                            
                                #include #include #include #pragma comment(lib,"Wininet.lib")#include using namespace std;int _tmain(int argc, _TCHAR* argv[]){ vector v; TCHAR ...
                            
                            
                                分类:
编程语言   时间:
2014-08-09 11:33:47   
                                阅读次数:
229
                             
                    
                        
                            
                            
                                C++为我们提供了安全的内存空间申请方式与释放方式,但是new与delete表达式却是把空间的分配回收与对象的构建销毁紧紧的关联在一起。实际上,作为与C语言兼容的语言,C++也为我们提供了更加底层的内存操作方式的。
谈C++就离不开STL,考虑一下vector
template class T>
void Vector::push_back(const T& t)
{
// are w...
                            
                            
                                分类:
编程语言   时间:
2014-08-09 00:14:07   
                                阅读次数:
409
                             
                    
                        
                            
                            
                                第一题是整数的方阵,求其中的子方阵,和最大。返回最大和以及子方阵宽度。因为做了topcoder的题,所以比较顺手,O(n^3)的复杂度。pair maxiSum(vector > &a) { //first is n second is sum int N = a.size(); in...
                            
                            
                                分类:
其他好文   时间:
2014-08-09 00:00:26   
                                阅读次数:
352
                             
                    
                        
                            
                            
                                vector的capacity()调用返回vector中最大能够存储的元素个数,也即在下一次需要扩充容量之前能容纳的元素个数。reserve会使容器在必要的时候增长,以便容纳制指定数目的元素。#include #include using namespace std;int main(){ ...
                            
                            
                                分类:
其他好文   时间:
2014-08-08 21:07:46   
                                阅读次数:
209
                             
                    
                        
                            
                            
                                Camel trading
Time Limit: 1 second
Background
Aroud 800 A.D., El Mamum, Calif of Baghdad was presented the formula 1+2*3*4+5, which had its origin in the financial accounts of a c...
                            
                            
                                分类:
其他好文   时间:
2014-08-08 18:21:52   
                                阅读次数:
273
                             
                    
                        
                            
                            
                                支持向量机SVM(Support Vector Machine)作为一种可训练的机器学习方法可以实现模式分类和非线性回归,本文就matlab中的LIBSVM工具箱展开说明。...
                            
                            
                                分类:
其他好文   时间:
2014-08-08 16:13:16   
                                阅读次数:
315