前几天看的webrtc实际上一直是libjingle的talk,base目录下的基础性东西,似乎是google在原来的webrtc的代码中又做了一些改进。现在由于工作的需要,所有的眼光都集中到webrtc上了,让我也不得不将精力向webrtc的代码靠拢。
最近几天的文章不会涉及到任何关于webrtc框架的东西,何况我也不懂框架,仅仅是对webrtc一些基础类的封装的使用的库,学鲁迅的拿来主义,读懂,然后据为己有,然后在自己的以后的编程中应用上面的思想进行改进。
今天主要讨论scoped_ptr,先上代码:
// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
// Copyright (c) 2001, 2002 Peter Dimov
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
//
// See http://www.boost.org/libs/smart_ptr/scoped_ptr.htm for documentation.
//
// scoped_ptr mimics a built-in pointer except that it guarantees deletion
// of the object pointed to, either on destruction of the scoped_ptr or via
// an explicit reset(). scoped_ptr is a simple solution for simple needs;
// use shared_ptr or std::auto_ptr if your needs are more complex.
// scoped_ptr_malloc added in by Google. When one of
// these goes out of scope, instead of doing a delete or delete[], it
// calls free(). scoped_ptr_malloc<char> is likely to see much more
// use than any other specializations.
// release()