03.12.2012 Views

C++ for Scientists - Technische Universität Dresden

C++ for Scientists - Technische Universität Dresden

C++ for Scientists - Technische Universität Dresden

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2.3. OPERATORS 29<br />

2.3.5 Bracket operators<br />

The operator [] is used access elements of an arrays (see § 2.9), and () <strong>for</strong> function calls.<br />

2.3.6 All operators<br />

We haven’t introduced all operators yet. They will be shown in an appropriate context. For<br />

now, we only list the entire operator set with their precedences and associativity. The table is<br />

taken from [?] (by courtesy of Bjarne Stroustrup). For more details about specific operators<br />

see there. The operators on top have the highest priorities. 6<br />

Operator Summary<br />

scope resolution class name :: member<br />

scope resolution namespace name :: member<br />

global :: name<br />

global :: qualified-name<br />

member selection object . member<br />

member selection pointer → member<br />

subscripting expr[ expr ]<br />

subscripting (user-defined) object [ expr ] 7<br />

function call expr ( expr list )<br />

value construction type ( expr list )<br />

post increment lvalue ++<br />

post decrement lvalue −−<br />

type identification typeid ( type )<br />

run-time type identification typeid ( expr )<br />

run-time checked conversion dynamic cast < type > ( expr )<br />

compile-time checked conversion static cast < type > ( expr )<br />

unchecked conversion reinterpret cast < type > ( expr )<br />

cast conversion const cast < type > ( expr )<br />

size of object sizeof expr<br />

size of type sizeof ( type )<br />

pre increment ++ lvalue<br />

pre decrement −− lvalue<br />

complement ∼ expr<br />

not ! expr<br />

unary minus − expr<br />

unary plus + expr<br />

address of & lvalue<br />

dereference ∗ lvalue<br />

create (allocate) new type<br />

create (allocate and initialize) new type( expr list )<br />

create (place) new ( expr list ) type<br />

create (place and initialize) new ( expr list ) type( expr list )<br />

destroy (deallocate) delete pointer<br />

destroy array delete [ ] pointer<br />

6 TODO: If possible references<br />

7 Not in [?].

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!