Click here to Skip to main content
15,879,535 members
Articles / Programming Languages / C++

A policy based reference counting implementation for compound objects

Rate me:
Please Sign up or sign in to vote.
4.77/5 (13 votes)
26 May 2005CPOL16 min read 33.1K   274   30  
Reference counting smart pointers and handles of various flavours.
/////////////////////////
//	c0.cpp

#include "stdafx.h"

#include "stdx/strings.hpp"

/// stdx::smart testing
//	run in debug mode an read messagess on the output window

using namespace GE_;


int main()
{
	STRACE(trc, 0, ("c0 main\n"));

	stdx::string<char> a('a',5);	//"aaaaa"
	stdx::string<char> b('b',10);	//"bbbbbbbbbb"
	stdx::string<char> c(a+b);		//"aaaaabbbbbbbbbb"
	stdx::string<char> d(c(3,4));	//"aabb"
	
	bool b1 = a<b; b1;
	bool b2 = b>c; b2;
	bool b3 = c>=d; b3;

	return 0;
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect
Italy Italy
Born and living in Milan (Italy), I'm an engineer in electronics actually working in the ICT department of an important oil/gas & energy company as responsible for planning and engineering of ICT infrastructures.
Interested in programming since the '70s, today I still define architectures for the ICT, deploying dedicated specific client application for engineering purposes, working with C++, MFC, STL, and recently also C# and D.

Comments and Discussions