Specifications
CAVR-4
118
Feature descriptions
AVR® IAR C/C++ Compiler
Reference Guide
Example
vector<int> d; // d placed in default memory, using
// the default heap, uses default
// pointers
vector<int __near> __near x; // x placed in near memory, heap
// allocation from near, uses
// pointers to near memory
vector<int __huge> __near y; // y placed in near memory, heap
// allocation from huge, uses
// pointers to huge memory
vector<int __near> __huge z; // Illegal
Note that map<key, T>, multimap<key, T>, hash_map<key, T>, and
hash_multimap<key, T> all use the memory of T. This means that the value_type
of these collections will be pair<key, const T> mem where mem is the memory type
of T. Supplying a key with a memory type is not useful.
Note that two containers that only differ by the data memory attribute they use cannot
be assigned to each other.
Example
vector<int __near> x;
vector<int __huge> y;
x = y; // Illegal
y = x; // Illegal
However, the templated assign member method will work:
x.assign(y.begin(), y.end());
y.assign(x.begin(), x.end());
STL and the IAR C-SPY Debugger
C-SPY has built-in display support for the STL containers.
VARIANTS OF CASTS
In Extended EC++ the following additional C++ cast variants can be used:
const_cast<t2>(t), static_cast<t2>(t), reinterpret_cast<t2>(t).
MUTABLE
The mutable attribute is supported in Extended EC++. A mutable symbol can be
changed even though the whole class object is const.