自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

#+!

  • 博客(531)
  • 资源 (1)
  • 收藏
  • 关注

转载 Static and dynamic libraries

A library is a package of code that is meant to be reused by many programs. Typically, a C++ library comes in two pieces:1) A header file that defines the functionality the library is exposing (of

2013-05-15 11:06:39 930

原创 QList 中的 append 和 push_back

void QList::pop_back ()This function is provided for STL compatibility. It is equivalent to removeLast(). The list must not be empty. If the list can be empty, call isEmpty() before calling this

2013-05-14 16:23:28 15861 2

原创 用Cmake编译调用Qxt,Qwt和Qserialport

最近用Cmake编译VTK-Qt 的程序, 需要调用Qwt. 以前在Qt creator里用.pro文件配置很方便. 现在要用Cmake吧header和 libraries 链接到程序.需要注意的是如果要使用Qdesigner设计界面的话, 要保证所有的相关libraries都要编译为Release. 如果自己写codes就没有这个限制, 只要debug保持一致或者 release保持一致.

2013-05-09 16:31:30 1579

原创 Essential C++ 学习笔记(七)

7 异常处理7.1 抛出异常 (Throwing an exception)抛出(throw)一个异常, 所谓异常(exceptions) 是某种对象.7.2 捕捉异常 (Catching an Exception)可以利用单一或连串的catch子句来捕捉(catch) 被抛出的异常对象.如果我们想要捕捉任何型别的异常, 可以用从catch-all的方式. catc

2013-05-04 16:20:01 557

原创 Essential C++ 学习笔记(六)

6.1 被参数化的型别 (Parameterized Types)在class template及其members的定义式中, 不需要以template parameter list进一步修饰class template. 除此之外,都需要以parameter list加以修饰.6.3 Template型别参数的处理在constructor定义式中,选择在member init

2013-05-01 15:40:05 603

转载 二叉树的遍历

树因为现实世界中存在这“树”这种结构——族谱、等级制度、目录分类等等,而为了研究这类问题,必须能够将树储存,而如何储存将取决于所需要的操作。这里有个问题,是否允许存在空树。有些书认为树都是非空的,因为树表示的是一种现实结构,而0不是自然数;我用过的教科书都是说可以有空树,当然是为了和二叉树统一。这个没有什么原则上的差别,反正就是一种习惯。二叉树二叉树可以说是人们假想的一

2013-05-01 15:22:20 548

原创 Essential C++ 学习笔记(五)

5.1 面向对象编程概念1. 面向对象风格的三个独特概念: 继承(inheritance), 多态(polymorphism), 动态绑定(Dynamic binding).2. 多态和动态绑定的特性, 只有在使用pointer或reference时才能发挥.5.2 面向对象编程思维1. 当程序定义出一个派生对象时, 基类和派生类的constructor都会被执行起来. 但

2013-04-29 15:29:08 613

转载 Google C++ Code Style

Header Files1. Define functions inline only when they are small, say, 10 lines or less2. When defining a function, parameter order is: inputs, then outputs3. Use standard order for reada

2013-04-24 20:01:01 1108

原创 传值,传指针,传引用和传指针引用

无论你传值还是传指针,函数都会生成一个临时变量,但传引用时,不会生成临时变量,当你传值时,只可以引用值而不可以改变值,但传值引用时,可以改变值,当你传指针时,只可以改变指针所指的内容,不可以改变指针本身,但传指针引用时,即可以改变指针所指的内容,又可以改变指针本身,但传引用主要是它不生成临时变量,不进行返回值copy等,速度快。指向常量的指针:可以改变指针指

2013-04-24 12:25:37 826

转载 Maximum Munch Principle

Most STL users are already aware of the need to put an extra space when taking a template as a template argument to any class. For example when you want to make a vector of complex numbers, which is

2013-04-22 16:30:53 806

原创 Essential C++ 学习笔记(四)

4. 基于对象的编程风格4.1 如何实现一个class1 前置声明使我们得以进行类指针(class pointer)的定义,或以此class作为数据类型.2 private members 只能在member function或是class friend内被取用.3 如果要在class 主体内定义, 这个member function会自动被视为inline函数.4.2

2013-04-22 16:29:20 772

转载 itk copy a image

templateclass itk::ImageDuplicatorA helper class which creates an image which is perfect copy of the input image.This class is NOT a filter. Although it has an API similar to a filter, this

2013-04-21 19:52:45 1228

转载 linear search 和 binary search的区别

A linear search looks down a list, one item at a time, without jumping. In complexity terms this is an O(n)search - the time taken to search the list gets bigger at the same rate as the list does.

2013-04-15 12:32:05 4191

转载 C++ standard exceptions

Standard exceptionsThe C++ Standard library provides a base class specifically designed to declare objects to be thrown as exceptions. It is called exception and is defined in the  header file und

2013-04-15 11:21:30 1143

原创 Essential C++ 学习笔记(三)

Generic Programming3.1 指针的算术运算array 不会以传值方式复制, 但数组被传给函数,或是由函数中返回时,仅有第一个元素的地址会被传递.vectoe可以是空的,array则否.3.3 所有容器的共通操作end()返回一个iterator, 指向容器的最后一个元素的下一个位置.3.4 使用序列式容器1. vector以一块连续的内存存放元素. 对

2013-04-14 15:52:43 765

转载 insert adapters C++

Inserters (also called "insert iterators") are "iterator adaptors" that permit algorithms (the copy algorithm, for example) to operate in insert mode rather than overwrite mode, which is the default

2013-04-14 14:52:13 639

转载 vector front back 与 begin end 的区别

std::vector::back" style="margin:0px; float:right; font-family:monospace; position:relative; top:-20px"> reference back();const_reference back() const;Access last elementReturns

2013-04-10 18:23:40 2471

转载 itk Transform SetParameters

void itk::BSplineBaseTransform< TScalarType, NDimensions, VSplineOrder >::SetParameters(const ParametersType & parameters) This method sets the parameters of the transform. F

2013-04-10 17:29:24 1107

转载 itk Get Image Region Methods

* LargestPossibleRegion is the total size of the image* BufferedRegion is the portion of the image that is currently loaded in memory* RequestedRegion is the portion that the pipe

2013-04-09 16:30:27 789

转载 友元函数和友元类

友元函数和友元类      采用类的机制后实现了数据的隐藏与封装,类的数据成员一般定义为私有成员,成员函数一般定义为公有的,依此提供类与外界间的通信接口。但是,有时需要定义一些函数,这些函数不是类的一部分,但又需要频繁地访问类的数据成员,这时可以将这些函数定义为该函数的友元函数。除了友元函数外,还有友元类,两者统称为友元。友元的作用是提高了程序的运行效率(即减少了类型检查和安全性检查等都需

2013-04-08 18:03:50 500

转载 itk image pyramid

templateclass itk::MultiResolutionPyramidImageFilterFramework for creating images in a multi-resolution pyramid.MultiResolutionPyramidImageFilter provides a generic framework to to create

2013-04-05 21:03:33 1103

转载 ITK registration optimizer scaling, offset and step length

The recommendation for the scaling of translation parametersversus rotation parameter is to use a factor proportional tothe diagonal length of the image.For your case the, you have 100 pixels with

2013-04-01 14:12:43 1065

转载 CenteredTransformInitializer 确定 Transform 初始中心

templateclass itk::CenteredTransformInitializerCenteredTransformInitializer is a helper class intended to initialize the center of rotation and the translation of Transforms having the center

2013-03-28 15:43:43 1521

原创 git connection error

Git error: fatal: unable to connect a socket (Invalid argument)Even after configuring the proxy, you might be unable to connect, since the proxy is disallowing git protocol traffic. In thi

2013-03-26 19:38:43 750

转载 RTTI C++

Run-time type identificationRun-time type identification (RTTI) lets you find the exact type of an object when you have only a pointer or reference to the base type. This can be thought

2013-03-26 17:40:39 1782

转载 stream iterators C++ 用法

流迭代器(Stream Iterators)1 输出流迭代器(Ostream Iterators)输出流迭代器可以把指定的内容直接写入指定的ostream。Ostream Iterator的实现原理跟Insert Iterator非常相似,唯一的区别就是Ostream Iterator利用下面列出了Ostream Iterator可以进行的所有操作:操作

2013-03-25 20:42:52 1235

转载 Jacobi and Guass-Seidel Iteration Update

Background    Iterative schemes require time to achieve sufficient accuracy and are reserved for large systems of equations where there are a majority of zero elements in the matrix. Often times t

2013-03-22 11:07:55 1787

转载 运算符重载C++

C++中预定义的运算符的操作对象只能是基本数据类型。但实际上,对于许多用户自定义类型(例如类),也需要类似的运算操作。这时就必须在C++中重新定义这些运算符,赋予已有运算符新的功能,使它能够用于特定类型执行特定的操作。运算符重载的实质是函数重载,它提供了C++的可扩展性。运算符重载是通过创建运算符函数实现的,运算符函数定义了重载的运算符将要进行的操作。运算符函数的定义与其他函数的定义类似,

2013-03-19 20:38:44 528

转载 函数指针的使用 C++

①函数指针的初始化。函数如下:1 int CompareString(const string& str1, const string& str2)2 {3     return str1.compare(str2);  4 }    函数的初始化有两种方式:  第一种,也是最普遍的方式:int (*CompareFunction)(const st

2013-03-19 20:09:08 711

原创 itk几个可以实现rotate的filter

A Versor *IS* a rotation. A versor is represented using the three first components of a Quaternion. The four components of a Quaternion correspond to:        q0 = Ax * sin( T / 2 )

2013-03-14 21:11:06 2020

转载 如何检查C++中的内存泄漏

内存泄漏是编程中常常见到的一个问题,我所遇过的原因有两个:1.分配完内存后忘记回收2.代码有问题,造成想回收却无法回收,例如:int* p=new int;p=new int;   //p指针修改,原来申请内存的地址没有记录下来,于是无法释放 下面介绍如何检查内存泄漏:1.包含头文件和定义#define _CRTDBG_MAP_ALLOC   /

2013-03-13 20:53:10 692

转载 C++中静态成员函数访问成员变量问题

C++会区分两种类型的成员函数:静态成员函数和非静态成员函数。这两者之间的一个重大区别是,静态成员函数不接受隐含的this自变量。所以,它就无法访问自己类的非静态成员。左例中分别声明了成员函数void add(),成员变量int a,和静态成员函数 static void staticfunc(),静态成员变量 static int sa.在staticfunc()的定

2013-03-13 20:52:31 6176

转载 局部静态变量和全局静态变量

静态变量的类型说明符是static。 静态变量当然是属于静态存储方式,但是属于静态存储方式的量不一定就是静态变量,例如外部变量虽属于静态存储方式,但不一定是静态变量,必须由 static加以定义后才能成为静态外部变量,或称静态全局变量。对于自动变量,它属于动态存储方式。 但是也可以用static定义它为静态自动变量,或称静态局部变量,从而成为静态存储方式。  由此看来, 一个变量可由sta

2013-03-13 20:50:49 2322

原创 Essential C++ 笔记 (二)

2.2 调用一个函数1. 将参数声明为reference的理由之一是,希望得以直接对所传入的对象进行修改.    将参数声明为reference的理由之二是,为了降低复制大型对象的负担.    大多数编译器对于以传值方式返回class object, 都会通过最佳化程序, 加上额外的reference参数.2. 但我们提领pointer时, 一定要先确定其值并非为0.3. 内建

2013-03-13 20:48:10 772

转载 C++ STL reserve和resize的区别

reserve是容器预留空间,但并不真正创建元素对象,在创建对象之前,不能引用容器内的元素,因此当加入新的元素时,需要用push_back()/insert()函数。resize是改变容器的大小,并且创建对象,因此,调用这个函数之后,就可以引用容器内的对象了,因此当加入新的元素时,用operator[]操作符,或者用迭代器来引用元素对象。再者,两个函数的形式是有区别的,reserve函数之

2013-03-12 20:38:25 12741

转载 C++ 模板函数和非模板函数的重载

关于函数的重载机制,是一个比较复杂的问题,其中涉及到了优先级定义和最佳匹配等问题,如果要阐述清楚,恐怕不是一两篇文章就能说的明白。但是如果掌握了一些常用的“规律”,对于了解程序对重载函数是如何进行选择也有很大的好处,本文尝试将自己理解的知识,结合下面简单的例子简略的说说函数重载机制,文章的摘录部分列出了一些关于程序如何选择重载函数的规则。: )例子如下:#include

2013-03-12 16:29:51 4508

转载 itk 空间变换分类

2013-03-11 11:32:14 869

转载 function objects 用法 C++

Function objectsFunction objects are objects specifically designed to be used with a syntax similar to that of functions. In C++, this is achieved by defining member function operator() in their c

2013-03-10 20:11:34 1954

转载 std::transform C++

std::transform" style="margin:0px; float:right; font-family:monospace; position:relative; top:-20px">unary operation(1)template OutputIterator transform (InputIterator first1, I

2013-03-10 20:08:19 1025

转载 C++类的多态性与虚函数的使用

1回顶部   类的多态特性是支持面向对象的语言最主要的特性,有过非面向对象语言开发经历的人,通常对这一章节的内容会觉得不习惯,因为很多人错误的认为,支持类的封装的语言就是支持面向对象的,其实不然,Visual BASIC 6.0 是典型的非面向对象的开发语言,但是它的确是支持类,支持类并不能说明就是支持面向对象,能够解决多态问题的语言,才是真正支持面向对象的开发的语言,所以务必提醒有过其它

2013-03-08 16:31:37 566

codeviewer

乱码查看

2011-11-11

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除