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 controls a
varying-length sequence of elements of type Elem,
also known as
value_type.
Such an element type must not require explicit construction or
destruction, and it must be suitable for use as the Elem
parameter to
basic_istream or
basic_ostream.
(A ``plain old data structure,'' or
POD, from C generally meets
this criterion.)
The Standard C++ library provides two specializations of this template
class, with the type definitions
string,
for elements of type char, and
wstring, for elements of type
wchar_t.

Various important properties of the elements
in a basic_string
specialization are described by the class Tr, also known as
traits_type.
A class that specifies these
character traits must
have the same external interface as an object of template class
char_traits.

The object allocates and frees storage for the sequence it controls
through a stored allocator object
of class Alloc, also known as
allocator_type.
Such an allocator object must have
the same external interface as an object of template class
allocator.
(Class
char_traits has
no provision for alternate addressing schemes, such as might be required
to implement a
far heap.)
Note that the stored allocator object is not copied when the container
object is assigned.

The sequences controlled by an object of template class
basic_string are usually called
strings. These objects should not be
confused, however, with the null-terminated
C strings used throughout the
Standard C++ library.

Many member functions require an
operand sequence of elements.
You can specify such an operand sequence several
ways:

ch -- one element
with value ch

count, ch -- a repetition of count elements each
with value ch

ptr -- a null-terminated sequence
(such as a C string,
for Elem of type char) beginning at
ptr (which must not be a null pointer),
where the terminating element is the value
value_type() and is not part of
the operand sequence

ptr, count -- a sequence of count elements
beginning at ptr (which must not be a null pointer)

right -- the sequence specified by the
basic_string object right

right, roff, count -- the substring of the
basic_string object right with up to count
elements (or through the end of the string, whichever comes first)
beginning at position roff

first, last -- a sequence of elements delimited
by the iterators first and last, in the
range [first, last), which may overlap
the sequence controlled by the string object whose member function
is being called

References, pointers, and iterators that designate elements of the
controlled sequence can become invalid after any call to a function
that alters the controlled sequence, or after the first call to the
non-const member functions
at,
begin,
end,
operator[],
rbegin, or
rend.
(The idea is to permit (but not require)
multiple strings to share the same representation
until one string becomes a candidate for change, at which point that string
makes a private copy of the representation, using a discipline called
copy on write.)

If InIt is an integer type, the template member
function behaves the same as append((size_type)first, (value_type)last).
Otherwise, the
member functions each append the
operand sequence to the end of the
sequence controlled by *this,
then return *this.

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

If InIt is an integer type, the template member
function behaves the same as assign((size_type)first, (value_type)last).
Otherwise, the
member functions each replace
the sequence controlled by *this with the
operand sequence, then return *this.

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

All constructors store an
allocator object and
initialize the controlled sequence. The allocator object is the argument
al, if present. For the copy constructor, it is
right.get_allocator().
Otherwise, it is Alloc().

The controlled sequence is initialized to a copy of the
operand sequence specified by the
remaining operands. A constructor with no operand sequence specifies an
empty initial controlled sequence.
If InIt is an integer type in a template constructor,
the operand sequence first, last behaves the same as
(size_type)first, (value_type)last.

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

The member function returns a pointer to a non-modifiable
C string constructed by adding a
terminating null element
(value_type()) to the controlled
sequence. Calling any non-const member function for
*this can invalidate the pointer.

The member functions each compare up to n0 elements of the
controlled sequence beginning with position off, or the
entire controlled sequence if these arguments are not supplied,
to the operand sequence.
Each function returns:

a negative value if the first differing element in the controlled
sequence compares less than the corresponding element in the operand
sequence (as determined by
traits_type::compare), or if the
two have a common prefix but the operand sequence is longer

zero if the two compare equal element by element and are the same
length

The signed integer type describes an object that can represent the
difference between the addresses of any two elements in the controlled
sequence. It is described here as a
synonym for the implementation-defined type T3.

The first member function removes the elements of the controlled
sequence in the range [first, last).
The second member function removes the element of the controlled
sequence pointed to by where.
Both return an iterator that designates the first element remaining
beyond any elements removed, or
end()
if no such element exists.

The third member function removes up to count elements of
the controlled sequence beginning at position off, then
returns *this.

The member functions each find the first (lowest beginning position)
subsequence in the controlled sequence, beginning on or after position
off, that matches the
operand sequence specified by the
remaining operands. If it succeeds, it returns the position where the
matching subsequence begins. Otherwise, the function returns
npos.

The member functions each find the first (lowest position) element of the
controlled sequence, at or after position off, that
matches none of the elements in the
operand sequence specified by the
remaining operands. If it succeeds, it returns the position. Otherwise,
the function returns
npos.

The member functions each find the first (lowest position) element of the
controlled sequence, at or after position off, that
matches any of the elements in the
operand sequence specified by the
remaining operands. If it succeeds, it returns the position. Otherwise,
the function returns
npos.

The member functions each find the last (highest position) element of the
controlled sequence, at or before position off, that
matches none of the elements in the
operand sequence specified by the
remaining operands. If it succeeds, it returns the position. Otherwise,
the function returns
npos.

The member functions each find the last (highest position) element of the
controlled sequence, at or before position off, that
matches any of the elements in the
operand sequence specified by the
remaining operands. If it succeeds, it returns the position. Otherwise,
the function returns
npos.

The member functions each insert, before position off or
before the element pointed to by where in the controlled
sequence, the
operand sequence specified by the
remaining operands. A function that returns a value returns
*this.
If InIt is an integer type in the template member function,
the operand sequence first, last behaves the same as
(size_type)first, (value_type)last.

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

The member functions each return a reference to the element of the
controlled sequence at position off. If that position is
invalid, the behavior is undefined. Note, however, that
cstr[cstr.size()] == 0 for the first member function.

The member functions each return a reverse iterator that points at the
first element of the sequence (or just beyond the end of an empty
sequence). Hence, the function designates the end of the reverse sequence.

The member functions each replace up to n0 elements of the
controlled sequence beginning with position off, or the
elements of the controlled sequence beginning with the one pointed to by
first, up to but not including last. The
replacement is the
operand sequence specified by the
remaining operands. The function then returns
*this.
If InIt is an integer type in the template member function,
the operand sequence first2, last2 behaves the same as
(size_type)first2, (value_type)last2.

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

The member function ensures that
size() henceforth
returns newsize. If it must make the controlled sequence longer,
it appends elements with value ch.
To make the controlled sequence shorter, the member function effectively calls
erase(begin() + newsize, end()).

The member functions each find the last
(highest beginning position) subsequence in
the controlled sequence, beginning on or before position off,
that matches the
operand sequence specified by the
remaining operands. If it succeeds, the function returns the position where the
matching subsequence begins. Otherwise, it returns
npos.

The member function swaps the controlled sequences between
*this and str. If
get_allocator()
== right.get_allocator(), it does so in constant time,
it throws no exceptions, and it invalidates no references, pointers,
or iterators that designate elements in the two controlled sequences.
Otherwise, it performs a number of element assignments and constructor calls
proportional to the number of elements in the two controlled sequences.

The template class describes various
character traits
for type Elem.
The template class
basic_string
as well as several iostreams template classes, including
basic_ios, use this information
to manipulate elements of type Elem.
Such an element type must not require explicit construction or
destruction. It must supply a default constructor, a copy constructor,
and an assignment operator, with the expected semantics.
A bitwise copy must have the same effect as an assignment.

If these choices don't meet your needs, you must supply your own
traits class.

Not all parts of the Standard C++ Library rely completely upon the member
functions of char_traits<Elem> to manipulate an element.
Specifically,
formatted input functions and
formatted output functions
make use of the following additional operations,
also with the expected semantics:

operator==(Elem) and operator!=(Elem)
to compare elements

(char)ch to convert an element ch
to its corresponding single-byte character code,
or '\0' if no such code exists

(Elem)ch to convert a char value ch to
its correponding character code of type Elem

None of the member functions of class char_traits may
throw exceptions.

The type is a signed integer type T3 that describes an
object that can store a byte offset involved in various stream
positioning operations. It is typically a synonym for
streamoff, but in any case it
has essentially the same properties as that type.

The type is an opaque type T2 that describes an object
that can store all the information needed to restore an arbitrary
file-position indicator
within a stream. It is typically a synonym for
streampos, but in any case it
has essentially the same properties as that type.

The type is an opaque type T4 that describes an object
that can represent a
conversion state. It is
typically a synonym for
mbstate_t, but in any
case it has essentially the same properties as that type.

The static member function returns ch represented as
type int_type. It must be possible to convert any value ch of type
Elem to int_type (by evaluating
meta = to_int_type(ch))
then back to Elem (by evaluating
ch = to_char_type(meta))
and obtain a value that compares equal to ch.

1. Choose your focus

This is the focus controller. Use this controller to choose your primary development approach (Cascades or Core).

By selecting a focus, you get to decide what content should be front and center on the site.

2. 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.

3. 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 check boxes to display the samples relevant to your focus.

4. Educate yourself

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

The documentation for your preferred focus always appears at the top of the left-hand navigation, but you can still access the rest of the documentation at the bottom.

5. 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.