It seems like the browser you are using has JavaScript disabled. As a result, the site will not function properly. We really want you to enable it so you may experience our site as we intended it. If you have no idea what we are talking about or if you need help, visit http://www.enable-javascript.com×
This website uses cookies. By continuing to browse this site you are agreeing to our use of cookies. Find out more on our cookie page.×

Oops, it seems like you're using an old browser that we do not fully support. If you're able to, please upgrade your browser here.×
This website uses cookies. By continuing to browse this site you are agreeing to our use of cookies. Find out more on our cookie page.×

The template class describes an object that manages
storage allocation and freeing for arrays of objects of type Ty.
An object of class allocator is the default
allocator object
specified in the constructors for several
container template classes in the Standard C++ library.

Template class allocator supplies several
type definitions that are rather pedestrian.
They hardly seem worth defining.
But another class with the same members
might choose more interesting alternatives.
Constructing a container with an allocator object of such a class
gives individual control over allocation and freeing
of elements controlled by that container.

For example, an allocator object might allocate storage on a
private heap.
Or it might allocate storage on a
far heap, requiring nonstandard
pointers to access the allocated objects. Or it might specify,
through the type definitions it supplies, that elements be
accessed through special
accessor objects that manage
shared memory, or perform automatic
garbage collection.
Hence, a class that allocates storage using an allocator object
should use these types religiously for declaring pointer and
reference objects (as do the containers in the Standard C++ library).

These types specify the form that pointers and references
must take for allocated elements.
(allocator::pointer is not necessarily
the same as Ty * for all allocator objects, even though
it has this obvious definition for class allocator.)

The member function allocates storage for
an array of count elements of type Ty, by calling
operator new(count).
It returns a pointer to the allocated object.
The hint argument helps some allocators
in improving locality of reference -- a valid choice
is the address of an object earlier allocated by the same allocator
object, and not yet deallocated. To supply no
hint, use a null pointer argument instead.

The constructor does nothing. In general, however, an allocator object
constructed from another allocator object should compare equal to it
(and hence permit intermixing of object allocation and freeing between
the two allocator objects).

The member function frees storage for
the array of count objects of type
Ty beginning at ptr, by calling
operator delete(ptr).
The pointer ptr must have been earlier returned by a call to
allocate for an allocator
object that compares equal to *this, allocating an array object
of the same size and type.
deallocate never throws an exception.

The template assignment operator does nothing.
In general, however, an allocator object
assigned to another allocator object should compare equal to it
(and hence permit intermixing of object allocation and freeing between
the two allocator objects).

The class explicitly specializes template class
allocator for type void.
Its constructors and assignment operator behave the same as for the
template class, but it defines only the types
const_pointer,
pointer,
value_type,
and the nested template class
rebind.

The class describes an object that stores a pointer to an allocated object
myptr of type Ty *. The stored pointer must either be null or
designate an object allocated by a
new expression.
An object constructed with a non-null pointer owns the pointer.
It transfers ownership if its stored value is assigned to another
object. (It replaces the stored value after a transfer with a null pointer.)
The destructor for auto_ptr<Ty>
deletes the allocated object if it owns it.
Hence, an object of class auto_ptr<Ty>
ensures that an allocated object is automatically deleted when
control leaves a block, even via a thrown excepiton.
You should not construct two auto_ptr<Ty> objects
that own the same object.

You can pass an auto_ptr<Ty> object by value as an
argument to a function call. You can return such an object by value as well.
(Both operations depend on the implicit construction of intermediate objects
of class auto_ptr_ref<Ty>, by various
subtle conversion rules.) You cannot, however, reliably manage a sequence of
auto_ptr<Ty> objects with an STL
container.

The first constructor stores ptr in myptr,
the stored pointer to the allocated object.
The second constructor transfers ownership of the
pointer stored in right, by storing
right.release()
in myptr.
The third constructor behaves the same as the second, except
that it stores right.ref.release() in myptr, where ref
is the reference stored in right.

The template constructor behaves the same as the second constructor,
provided that a pointer to Other can be implicitly converted
to a pointer to Ty.

The assignment evaluates the expression delete myptr,
but only if the stored pointer myptr
changes as a result of the assignment.
It then transfers ownership of the pointer designated by right, by storing
right.release() in myptr.
(The last assignment behaves as if right designates the reference
it stores.) The function returns *this.

The selection operator returns
get(),
so that the expression ap->member behaves the same as
(ap.get())->member, where ap is an object
of class auto_ptr<Ty>.
Hence, the stored pointer must not be null, and Ty
must be a class, structure, or union type with a member member.

The class describes an object that stores a reference to an object of class
auto_ptr<Ty>. It is used as a helper
class for auto_ptr<Ty>. You should not have an occasion
to construct an auto_ptr_ref<Ty> object directly.

The template function allocates storage for a sequence of at most
count elements of type Ty, from an unspecified
source (which may well be the standard heap used by
operator new).
It returns a value pr, of type
pair<Ty *, ptrdiff_t>.
If the function allocates storage,
pr.first designates
the allocated storage and
pr.second
is the number of elements in the longest sequence the storage can hold.
Otherwise, pr.first is a null pointer.

In this implementation,
if a translator does not support member template functions, the template:

The class describes an output iterator
that constructs objects of type Ty
in the sequence it generates. An object of class
raw_storage_iterator<FwdIt, Ty>
accesses storage through a forward iterator object,
of class FwdIt, that you specify when you construct
the object. For an object first of class FwdIt,
the expression &*first must designate unconstructed storage for
the next object (of type Ty) in the generated sequence.

The assignment operator constructs the next object in the
output sequence using the stored iterator value first,
by evaluating the
placement new expression
new ((void *)&*first) Ty(val).
The function returns *this.

1. Download the tools

Before you start developing, you'll need to visit the Downloads tab. Here you'll find downloads for the BlackBerry 10 Native SDK, BlackBerry 10 Device Simulator, and some other useful tools.

2. Try the sample apps

Now featuring a filter control, the Sample apps tab allows you to search for samples by name or by feature.

Select either the Core or Cascades radio buttons to display the samples relevant to you.

3. Educate yourself

The Documentation tab contains tons of examples, tutorials, and best practices to guide you along the path towards building an awesome app.

You can access all the documentation that you need in the left-hand navigation.

4. Start developing

The Reference tab is where you'll find essential details about how to use our APIs.

You can use the left-hand navigation to choose how you would like to browse the reference: by module, by topic, or alphabetically. If you have an idea of what you are looking for, start typing it in the Filter box.