Petr
Petr

Reputation: 14505

where can I find well documented source code of smart pointers in c++11

I would like to find how the smart pointers used in c++11 (implemented by memory.h) are actually implemented, preferably in some easy-to-read form.

When I open /usr/include/memory.h I just see this:

// license removed as well as blank lines
#ifndef _MEMORY_H
#define _MEMORY_H       1
#include <features.h>
#ifndef _STRING_H
# include <string.h>
#endif  /* string.h  */
#endif  /* memory.h  */

in features.h I get in another maze of includes. Is there some document that contains details of the implementation together with source codes?

Upvotes: 2

Views: 83

Answers (1)

echristo
echristo

Reputation: 1727

Well documented is the problem. Looking at libc++ and libstdc++ is probably the best bet and then documenting it as you go along might work. The implementations appear to be pretty reasonable:

http://llvm.org/svn/llvm-project/libcxx/trunk/include/memory http://llvm.org/svn/llvm-project/libcxx/trunk/src/memory.cpp

for llvm seems to be fairly clean.

Upvotes: 6

Related Questions