The Simple Functional Template Library
[[make_new]]
 

make_new

Definition

template<class T>
T* make_new( T& value );
 
template<class U,class T>
T* make_new( U& value );

Parameters

Parameter Description
value the object or value to be copied

Return value

An object or value of type T*

Description

Allocates a new object or value of type T from the given value using the copy constructor

Examples

vector<int> numbers;
...
// makes a vector of *int from numbers (same type)
vector<int*> v1 = map( numbers, make_new<int> );
 
// makes a vector of *double from numbers (different type)
vector<double*> v1 = map( numbers, make_new<int,double> );
 
make_new.txt · Last modified: 2007/08/24 23:31 (external edit)
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki