<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[hongjunbj的专栏]]></title><description><![CDATA[]]></description><link>https://blog.youkuaiyun.com/hongjunbj</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; hongjunbj]]></copyright><item><title><![CDATA[几种常见排序算法的实现（冒泡法，选择法，插入法，快速排序、堆排序）]]></title><link>https://blog.youkuaiyun.com/hongjunbj/article/details/25747587</link><guid>https://blog.youkuaiyun.com/hongjunbj/article/details/25747587</guid><author>hongjunbj</author><pubDate>Tue, 13 May 2014 23:05:49 +0800</pubDate><description><![CDATA[#include "stdafx.h"

//in the i th round ordering, j always points to the max element so far
void bubble_sort(int *a, int len)
{
	for(int i=0; i<len-1; i++)
	{
		for(int j=0; j<len-1-i; j++)
		{
			if]]></description><category></category></item><item><title><![CDATA[关于虚继承需要注意的几个问题]]></title><link>https://blog.youkuaiyun.com/hongjunbj/article/details/24989319</link><guid>https://blog.youkuaiyun.com/hongjunbj/article/details/24989319</guid><author>hongjunbj</author><pubDate>Sun, 04 May 2014 17:11:49 +0800</pubDate><description><![CDATA[1、在普通继承中，D和A的关系是B is a A， 在虚继承中，B和A的关系是B has a A]]></description><category></category></item><item><title><![CDATA[智能指针的一种实现]]></title><link>https://blog.youkuaiyun.com/hongjunbj/article/details/24671627</link><guid>https://blog.youkuaiyun.com/hongjunbj/article/details/24671627</guid><author>hongjunbj</author><pubDate>Mon, 28 Apr 2014 22:28:40 +0800</pubDate><description><![CDATA[std的auto_ptr实现了接口
get]]></description><category></category></item><item><title><![CDATA[Game of Paper, Rock and scissors]]></title><link>https://blog.youkuaiyun.com/hongjunbj/article/details/24498457</link><guid>https://blog.youkuaiyun.com/hongjunbj/article/details/24498457</guid><author>hongjunbj</author><pubDate>Fri, 25 Apr 2014 22:17:57 +0800</pubDate><description><![CDATA[Paper-Scissors-Rock is a game for two players. Each player simultaneously opens his/her hand to display a symbol:
* Fist equals rock,
* Open hand equals paper,
* Showing the index and middle finger]]></description><category></category></item><item><title><![CDATA[C++智能指针的对比]]></title><link>https://blog.youkuaiyun.com/hongjunbj/article/details/24424631</link><guid>https://blog.youkuaiyun.com/hongjunbj/article/details/24424631</guid><author>hongjunbj</author><pubDate>Thu, 24 Apr 2014 17:14:01 +0800</pubDate><description><![CDATA[一、简介

由于 C++ 语言没有自动内存回收机制，程序员每次 new 出来的内存都要手动 delete。程序员忘记 delete，流程太复杂，最终导致没有 delete，异常导致程序过早退出，没有执行 delete 的情况并不罕见。

用智能指针便可以有效缓解这类问题，本文主要讲解参见的智能指针的用法。包括：std::auto_ptr、boost::scoped_ptr、boost::s]]></description><category></category></item><item><title><![CDATA[The minimum number of elements to reach the end of an array]]></title><link>https://blog.youkuaiyun.com/hongjunbj/article/details/22823249</link><guid>https://blog.youkuaiyun.com/hongjunbj/article/details/22823249</guid><author>hongjunbj</author><pubDate>Wed, 02 Apr 2014 21:41:33 +0800</pubDate><description><![CDATA[Given an array of integers, each element represents the max number of jumps that you can move forward.
Write a piece of code to find out the minimum number of elements you need to select to reach the]]></description><category></category></item><item><title><![CDATA[Apollo Rule Reverse]]></title><link>https://blog.youkuaiyun.com/hongjunbj/article/details/22822677</link><guid>https://blog.youkuaiyun.com/hongjunbj/article/details/22822677</guid><author>hongjunbj</author><pubDate>Wed, 02 Apr 2014 20:59:24 +0800</pubDate><description><![CDATA[1. The string consist of ASCII characters.
2. There are three types of segment in string: word, non-word and "#".
Word begins with letter which can be followed with every character except ‘#’(e.g. ‘]]></description><category></category></item><item><title><![CDATA[C++模板]]></title><link>https://blog.youkuaiyun.com/hongjunbj/article/details/19822437</link><guid>https://blog.youkuaiyun.com/hongjunbj/article/details/19822437</guid><author>hongjunbj</author><pubDate>Mon, 24 Feb 2014 14:42:41 +0800</pubDate><description><![CDATA[原来...
C++ template

1.自定义Stack模板类

#include 
#include 

template 
class Stack {
  private:
    std::vector elems;     // elements

  public:
    void push(T const&);      // push element
    void pop(]]></description><category></category></item><item><title><![CDATA[队列另一种实现（链表）]]></title><link>https://blog.youkuaiyun.com/hongjunbj/article/details/19628381</link><guid>https://blog.youkuaiyun.com/hongjunbj/article/details/19628381</guid><author>hongjunbj</author><pubDate>Fri, 21 Feb 2014 16:43:59 +0800</pubDate><description><![CDATA[头文件
typedef struct Node
{
	int val;
	Node *next;
	Node(){next=NULL;}
	Node(int v)
	{
		val = v;
		next = NULL;
	}
}Node;

class QueueList
{
public:
	QueueList(int max);
	~QueueList();
	int pop();
	vo]]></description><category></category></item><item><title><![CDATA[栈的一种实现（数组）]]></title><link>https://blog.youkuaiyun.com/hongjunbj/article/details/19564223</link><guid>https://blog.youkuaiyun.com/hongjunbj/article/details/19564223</guid><author>hongjunbj</author><pubDate>Thu, 20 Feb 2014 17:22:14 +0800</pubDate><description><![CDATA[头文件
const int MAX_STACK_NUM = 4;

class Stack
{
public:
	Stack();
	~Stack();
	int pop();
	void push(int x);
	int peek() const;
	int count();

private:
	int m_pos;//m_pos-1为栈顶元素的位置
	int m_data[MAX_STA]]></description><category></category></item><item><title><![CDATA[队列的一种实现（数组）]]></title><link>https://blog.youkuaiyun.com/hongjunbj/article/details/19564011</link><guid>https://blog.youkuaiyun.com/hongjunbj/article/details/19564011</guid><author>hongjunbj</author><pubDate>Thu, 20 Feb 2014 17:17:28 +0800</pubDate><description><![CDATA[头文件
const int MAX_QUEUE_NUM = 4;

class Queue
{
public:
	Queue();
	~Queue();
	int pop();
	void push(int x);
	int getFront() const;
	int count();

private:
	int m_pos;//记录第一个元素的位置
	int m_count;
	int m]]></description><category></category></item><item><title><![CDATA[back_inserter & front_inserter & inserter的用法]]></title><link>https://blog.youkuaiyun.com/hongjunbj/article/details/16887609</link><guid>https://blog.youkuaiyun.com/hongjunbj/article/details/16887609</guid><author>hongjunbj</author><pubDate>Fri, 22 Nov 2013 17:05:58 +0800</pubDate><description><![CDATA[这几种iterator一般用于copy类型的函数，如sort_copy, copy, unique_copy，因为copy系列的函数不检查dest参数的有效性，即是否已经分配了内存
#include 
#include 
#include 
#include 

template
void print(T &vec)
{
    for(auto iter=vec.begin(); iter !]]></description><category></category></item><item><title><![CDATA[std::sort & unique的用法示例]]></title><link>https://blog.youkuaiyun.com/hongjunbj/article/details/16884415</link><guid>https://blog.youkuaiyun.com/hongjunbj/article/details/16884415</guid><author>hongjunbj</author><pubDate>Fri, 22 Nov 2013 16:29:04 +0800</pubDate><description><![CDATA[这两个通用函数主要用于vector。其他container如list有自己的sort和unique方法


示例：
#include 
#include 
#include 
int main(int argc, char **argv)
{
    
    int array1[] = {10, -7, 3, 4, 4, -7};
    vector myset(array1, ar]]></description><category></category></item><item><title><![CDATA[调用运算符和转换运算符--两个容易混淆的运算符]]></title><link>https://blog.youkuaiyun.com/hongjunbj/article/details/11801799</link><guid>https://blog.youkuaiyun.com/hongjunbj/article/details/11801799</guid><author>hongjunbj</author><pubDate>Wed, 18 Sep 2013 11:37:39 +0800</pubDate><description><![CDATA[***************************************************************************** 
重载调用操作符 () // 也称函数对象 
定义了调用操作符 () 的类，其对象常称为函数对象，它比函数更加灵活和方便 
函数对象常用于通用算法的实参 
可以为类的对象重载调用操作符 () ，如用结构实现的求绝对值的结构]]></description><category></category></item><item><title><![CDATA[成员函数和友元函数的选择方案指导原则]]></title><link>https://blog.youkuaiyun.com/hongjunbj/article/details/11801367</link><guid>https://blog.youkuaiyun.com/hongjunbj/article/details/11801367</guid><author>hongjunbj</author><pubDate>Wed, 18 Sep 2013 11:27:09 +0800</pubDate><description><![CDATA[成员函数和非成员函数 ( 友元函数 ) 选择方案 
  通常对类本身的操作 ,( 如赋值 =, 下标 [], 调用 (), 成员访问符 ->, 自增 ++, 自减 --) 请选择成员函数 
  通常对两个对象进行操作 ,( 如算术操作 , 位操作符 , 关系操作 , 输入输出 ) 请选择非成员函数 , 就是用友元函数实现 
成员 / 非成员函数重载选择指导 
一元操作符就是操作符有一个对象]]></description><category></category></item><item><title><![CDATA[Constructor/Destructor/Copy Constructor/operator =]]></title><link>https://blog.youkuaiyun.com/hongjunbj/article/details/11779291</link><guid>https://blog.youkuaiyun.com/hongjunbj/article/details/11779291</guid><author>hongjunbj</author><pubDate>Tue, 17 Sep 2013 17:16:07 +0800</pubDate><description><![CDATA[1) If you have created any constructors or even copy constructors, the compiler won't create default constructor for you.
2) operator =, copy constructor and destructor are siblings, if we overwrite]]></description><category></category></item><item><title><![CDATA[std::map [] operator 和 insert 的区别]]></title><link>https://blog.youkuaiyun.com/hongjunbj/article/details/11631011</link><guid>https://blog.youkuaiyun.com/hongjunbj/article/details/11631011</guid><author>hongjunbj</author><pubDate>Fri, 13 Sep 2013 10:29:35 +0800</pubDate><description><![CDATA[如果key已经存在，[] operator会将key对应的value用新值替换，而insert会返回一个pair说这组元素已经存在。
如果key不存在，二者效果相同
示例：

void print(std::map &intmap)
{
	using namespace std;
	auto iter = intmap.begin();
	for(; iter != intmap.end(]]></description><category></category></item><item><title><![CDATA[R6025调用纯虚函数错误]]></title><link>https://blog.youkuaiyun.com/hongjunbj/article/details/10114411</link><guid>https://blog.youkuaiyun.com/hongjunbj/article/details/10114411</guid><author>hongjunbj</author><pubDate>Tue, 20 Aug 2013 16:46:15 +0800</pubDate><description><![CDATA[class A;

   void fcn( A* );

   class A
   {
   public:
	   virtual void f()=0;
	   A() { fcn(this); }
   };

   class B : A
   {
       void f() { }
   };

   void fcn( A* p )
   {
       p->f();//h]]></description><category></category></item><item><title><![CDATA[stream_iterator的用法]]></title><link>https://blog.youkuaiyun.com/hongjunbj/article/details/10112823</link><guid>https://blog.youkuaiyun.com/hongjunbj/article/details/10112823</guid><author>hongjunbj</author><pubDate>Tue, 20 Aug 2013 16:31:13 +0800</pubDate><description><![CDATA[#include 
#include 
#include 
#include 
#include 

using namespace std;
int main()
{
    istringstream ss("abc dfn fasd nny");
    istream_iterator in(ss);
    istream_iterator end;
    vector vec_tmp]]></description><category></category></item><item><title><![CDATA[关于VS的release版本调试]]></title><link>https://blog.youkuaiyun.com/hongjunbj/article/details/9464897</link><guid>https://blog.youkuaiyun.com/hongjunbj/article/details/9464897</guid><author>hongjunbj</author><pubDate>Thu, 25 Jul 2013 10:18:17 +0800</pubDate><description><![CDATA[有时我们自己写的代码只能用release版本（比如调用第三方库只提供release版本，如果自己的那部分代码使用debug版本的话，两边版本不匹配经常会出问题），但是又希望针对自己的写的那部分代码调试，这个时候可以用这个方法
在VS中选择project--》右键property--》c/c++--》optimization找到optimization项，将maximize speed/O2 修改]]></description><category></category></item></channel></rss>