mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-04 01:11:36 +08:00
More uClibc++ build fixes
git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5299 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -247,9 +247,13 @@ examples/cxxtest
|
|||||||
is not included in the NuttX source tree by default, but must be installed
|
is not included in the NuttX source tree by default, but must be installed
|
||||||
(see misc/uClibc++/README.txt for installation).
|
(see misc/uClibc++/README.txt for installation).
|
||||||
|
|
||||||
The only NuttX setting that is required is:
|
The NuttX setting that are required include:
|
||||||
|
|
||||||
CONFIG_HAVE_CXX=y
|
CONFIG_HAVE_CXX=y
|
||||||
|
CONFIG_HAVE_CXXINITIALIZE=y
|
||||||
|
CONFIG_UCLIBCXX=y
|
||||||
|
|
||||||
|
Additional uClibc++ settings may be required in your build environment.
|
||||||
|
|
||||||
The uClibc++ test includes simple test of:
|
The uClibc++ test includes simple test of:
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
@@ -26,8 +25,8 @@
|
|||||||
#ifndef __STD_HEADER_DEQUE
|
#ifndef __STD_HEADER_DEQUE
|
||||||
#define __STD_HEADER_DEQUE
|
#define __STD_HEADER_DEQUE
|
||||||
|
|
||||||
|
namespace std
|
||||||
namespace std{
|
{
|
||||||
template <class T, class Allocator = allocator<T> > class deque;
|
template <class T, class Allocator = allocator<T> > class deque;
|
||||||
template <class T, class Allocator> bool operator==(const deque<T,Allocator>& x, const deque<T,Allocator>& y);
|
template <class T, class Allocator> bool operator==(const deque<T,Allocator>& x, const deque<T,Allocator>& y);
|
||||||
template <class T, class Allocator> bool operator< (const deque<T,Allocator>& x, const deque<T,Allocator>& y);
|
template <class T, class Allocator> bool operator< (const deque<T,Allocator>& x, const deque<T,Allocator>& y);
|
||||||
@@ -107,14 +106,20 @@ namespace std{
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void reserve(size_type n);
|
void reserve(size_type n);
|
||||||
inline size_type array_element(size_type deque_element) const{
|
|
||||||
if(deque_element < (data_size - first_element)){
|
inline size_type array_element(size_type deque_element) const
|
||||||
|
{
|
||||||
|
if (deque_element < (data_size - first_element))
|
||||||
|
{
|
||||||
return first_element + deque_element;
|
return first_element + deque_element;
|
||||||
}
|
}
|
||||||
return deque_element - (data_size - first_element);
|
return deque_element - (data_size - first_element);
|
||||||
}
|
}
|
||||||
inline size_type first_subtract(size_type sub_size) const{
|
|
||||||
if(sub_size > first_element){
|
inline size_type first_subtract(size_type sub_size) const
|
||||||
|
{
|
||||||
|
if (sub_size > first_element)
|
||||||
|
{
|
||||||
return (data_size - first_element) - sub_size;
|
return (data_size - first_element) - sub_size;
|
||||||
}
|
}
|
||||||
return first_element - sub_size;
|
return first_element - sub_size;
|
||||||
@@ -129,7 +134,6 @@ namespace std{
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template<class T, class Allocator> class _UCXXEXPORT deque<T, Allocator>::deque_iter
|
template<class T, class Allocator> class _UCXXEXPORT deque<T, Allocator>::deque_iter
|
||||||
: public std::iterator<
|
: public std::iterator<
|
||||||
random_access_iterator_tag,
|
random_access_iterator_tag,
|
||||||
@@ -147,136 +151,202 @@ namespace std{
|
|||||||
public:
|
public:
|
||||||
deque_iter() : container(0), element(0) { }
|
deque_iter() : container(0), element(0) { }
|
||||||
deque_iter(const deque_iter & d) : container (d.container), element(d.element) { }
|
deque_iter(const deque_iter & d) : container (d.container), element(d.element) { }
|
||||||
|
|
||||||
deque_iter(deque<T, Allocator> * c, typename Allocator::size_type e)
|
deque_iter(deque<T, Allocator> * c, typename Allocator::size_type e)
|
||||||
: container(c), element(e)
|
: container(c), element(e)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
~deque_iter() { }
|
~deque_iter() { }
|
||||||
deque_iter & operator=(const deque_iter & d){
|
|
||||||
|
deque_iter & operator=(const deque_iter & d)
|
||||||
|
{
|
||||||
container = d.container;
|
container = d.container;
|
||||||
element = d.element;
|
element = d.element;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
T & operator*(){
|
|
||||||
|
T & operator*()
|
||||||
|
{
|
||||||
return container->data[container->array_element(element)];
|
return container->data[container->array_element(element)];
|
||||||
}
|
}
|
||||||
T * operator->(){
|
|
||||||
|
T * operator->()
|
||||||
|
{
|
||||||
return container->data + container->array_element(element);
|
return container->data + container->array_element(element);
|
||||||
}
|
}
|
||||||
const T & operator*() const{
|
|
||||||
|
const T & operator*() const
|
||||||
|
{
|
||||||
return container->data[container->array_element(element)];
|
return container->data[container->array_element(element)];
|
||||||
}
|
}
|
||||||
const T * operator->() const{
|
|
||||||
|
const T * operator->() const
|
||||||
|
{
|
||||||
return container->data + container->array_element(element);
|
return container->data + container->array_element(element);
|
||||||
}
|
}
|
||||||
bool operator==(const deque_iter & d) const{
|
|
||||||
|
bool operator==(const deque_iter & d) const
|
||||||
|
{
|
||||||
|
if (container == d.container && element == d.element)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator==(const deque_citer & d) const
|
||||||
|
{
|
||||||
if (container == d.container && element == d.element){
|
if (container == d.container && element == d.element){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool operator==(const deque_citer & d) const{
|
|
||||||
if(container == d.container && element == d.element){
|
bool operator!=(const deque_iter & d) const
|
||||||
|
{
|
||||||
|
if (container != d.container || element != d.element)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool operator!=(const deque_iter & d) const{
|
|
||||||
if(container != d.container || element != d.element){
|
bool operator!=(const deque_citer & d) const
|
||||||
|
{
|
||||||
|
if (container != d.container || element != d.element)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool operator!=(const deque_citer & d) const{
|
|
||||||
if(container != d.container || element != d.element){
|
bool operator<(const deque_iter & d) const
|
||||||
return true;
|
{
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
bool operator<(const deque_iter & d) const{
|
|
||||||
if (element < d.element){
|
if (element < d.element){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool operator<(const deque_citer & d) const{
|
|
||||||
|
bool operator<(const deque_citer & d) const
|
||||||
|
{
|
||||||
if (element < d.element){
|
if (element < d.element){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool operator<=(const deque_iter & d) const{
|
|
||||||
|
bool operator<=(const deque_iter & d) const
|
||||||
|
{
|
||||||
if (element <= d.element){
|
if (element <= d.element){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool operator<=(const deque_citer & d) const{
|
|
||||||
|
bool operator<=(const deque_citer & d) const
|
||||||
|
{
|
||||||
if (element <= d.element){
|
if (element <= d.element){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool operator>(const deque_iter & d) const{
|
|
||||||
if(element > d.element){
|
bool operator>(const deque_iter & d) const
|
||||||
|
{
|
||||||
|
if (element > d.element)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool operator>(const deque_citer & d) const{
|
|
||||||
if(element > d.element){
|
bool operator>(const deque_citer & d) const
|
||||||
|
{
|
||||||
|
if (element > d.element)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool operator>=(const deque_iter & d) const{
|
|
||||||
if(element >= d.element){
|
bool operator>=(const deque_iter & d) const
|
||||||
|
{
|
||||||
|
if (element >= d.element)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool operator>=(const deque_citer & d) const{
|
|
||||||
if(element >= d.element){
|
bool operator>=(const deque_citer & d) const
|
||||||
|
{
|
||||||
|
if (element >= d.element)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
deque_iter & operator++(){
|
|
||||||
|
deque_iter & operator++()
|
||||||
|
{
|
||||||
++element;
|
++element;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
deque_iter operator++(int){
|
|
||||||
|
deque_iter operator++(int)
|
||||||
|
{
|
||||||
deque_iter temp(container, element);
|
deque_iter temp(container, element);
|
||||||
++element;
|
++element;
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
deque_iter operator+(typename Allocator::size_type n){
|
|
||||||
|
deque_iter operator+(typename Allocator::size_type n)
|
||||||
|
{
|
||||||
deque_iter temp(container, element + n);
|
deque_iter temp(container, element + n);
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
deque_iter & operator+=(typename Allocator::size_type n){
|
|
||||||
|
deque_iter & operator+=(typename Allocator::size_type n)
|
||||||
|
{
|
||||||
element += n;
|
element += n;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
deque_iter & operator--(){
|
|
||||||
|
deque_iter & operator--()
|
||||||
|
{
|
||||||
--element;
|
--element;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
deque_iter operator--(int){
|
|
||||||
|
deque_iter operator--(int)
|
||||||
|
{
|
||||||
deque_iter temp(container, element);
|
deque_iter temp(container, element);
|
||||||
--element;
|
--element;
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
deque_iter operator-(typename Allocator::size_type n){
|
|
||||||
|
deque_iter operator-(typename Allocator::size_type n)
|
||||||
|
{
|
||||||
deque_iter temp(container, element - n);
|
deque_iter temp(container, element - n);
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
deque_iter & operator-=(typename Allocator::size_type n){
|
|
||||||
|
deque_iter & operator-=(typename Allocator::size_type n)
|
||||||
|
{
|
||||||
element -= n;
|
element -= n;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
typename Allocator::size_type operator-(const deque_iter & d){
|
|
||||||
|
typename Allocator::size_type operator-(const deque_iter & d)
|
||||||
|
{
|
||||||
return element - d.element;
|
return element - d.element;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,130 +370,186 @@ namespace std{
|
|||||||
deque_citer() : container(0), element(0) { }
|
deque_citer() : container(0), element(0) { }
|
||||||
deque_citer(const deque_citer & d) : container (d.container), element(d.element) { }
|
deque_citer(const deque_citer & d) : container (d.container), element(d.element) { }
|
||||||
deque_citer(const deque_iter & d) : container (d.container), element(d.element) { }
|
deque_citer(const deque_iter & d) : container (d.container), element(d.element) { }
|
||||||
|
|
||||||
deque_citer(const deque<T, Allocator> * c, typename Allocator::size_type e)
|
deque_citer(const deque<T, Allocator> * c, typename Allocator::size_type e)
|
||||||
: container(c), element(e)
|
: container(c), element(e)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
~deque_citer() { }
|
~deque_citer() { }
|
||||||
deque_citer & operator=(const deque_iter & d){
|
|
||||||
|
deque_citer & operator=(const deque_iter & d)
|
||||||
|
{
|
||||||
container = d.container;
|
container = d.container;
|
||||||
element = d.element;
|
element = d.element;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
const T & operator*() const{
|
|
||||||
|
const T & operator*() const
|
||||||
|
{
|
||||||
return container->data[container->array_element(element)];
|
return container->data[container->array_element(element)];
|
||||||
}
|
}
|
||||||
const T * operator->() const{
|
|
||||||
|
const T * operator->() const
|
||||||
|
{
|
||||||
return container->data + container->array_element(element);
|
return container->data + container->array_element(element);
|
||||||
}
|
}
|
||||||
bool operator==(const deque_citer & d) const{
|
|
||||||
if(container == d.container && element == d.element){
|
bool operator==(const deque_citer & d) const
|
||||||
|
{
|
||||||
|
if (container == d.container && element == d.element)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool operator==(const deque_iter & d) const{
|
|
||||||
if(container == d.container && element == d.element){
|
bool operator==(const deque_iter & d) const
|
||||||
|
{
|
||||||
|
if (container == d.container && element == d.element)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool operator!=(const deque_citer & d) const{
|
|
||||||
if(container != d.container || element != d.element){
|
bool operator!=(const deque_citer & d) const
|
||||||
|
{
|
||||||
|
if (container != d.container || element != d.element)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool operator!=(const deque_iter & d) const{
|
|
||||||
if(container != d.container || element != d.element){
|
bool operator!=(const deque_iter & d) const
|
||||||
|
{
|
||||||
|
if (container != d.container || element != d.element)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool operator<(const deque_citer & d) const{
|
|
||||||
|
bool operator<(const deque_citer & d) const
|
||||||
|
{
|
||||||
if (element < d.element){
|
if (element < d.element){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool operator<(const deque_iter & d) const{
|
|
||||||
|
bool operator<(const deque_iter & d) const
|
||||||
|
{
|
||||||
if (element < d.element){
|
if (element < d.element){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool operator<=(const deque_citer & d) const{
|
|
||||||
|
bool operator<=(const deque_citer & d) const
|
||||||
|
{
|
||||||
if (element <= d.element){
|
if (element <= d.element){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool operator<=(const deque_iter & d) const{
|
|
||||||
|
bool operator<=(const deque_iter & d) const
|
||||||
|
{
|
||||||
if (element <= d.element){
|
if (element <= d.element){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool operator>(const deque_citer & d) const{
|
|
||||||
|
bool operator>(const deque_citer & d) const
|
||||||
|
{
|
||||||
if (element > d.element){
|
if (element > d.element){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool operator>(const deque_iter & d) const{
|
|
||||||
|
bool operator>(const deque_iter & d) const
|
||||||
|
{
|
||||||
if (element > d.element){
|
if (element > d.element){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool operator>=(const deque_citer & d){
|
|
||||||
|
bool operator>=(const deque_citer & d)
|
||||||
|
{
|
||||||
|
if (element >= d.element)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator>=(const deque_iter & d)
|
||||||
|
{
|
||||||
if (element >= d.element){
|
if (element >= d.element){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool operator>=(const deque_iter & d){
|
|
||||||
if(element >= d.element){
|
deque_citer & operator++()
|
||||||
return true;
|
{
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
deque_citer & operator++(){
|
|
||||||
++element;
|
++element;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
deque_citer operator++(int){
|
|
||||||
|
deque_citer operator++(int)
|
||||||
|
{
|
||||||
deque_citer temp(container, element);
|
deque_citer temp(container, element);
|
||||||
++element;
|
++element;
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
deque_citer operator+(typename Allocator::size_type n){
|
|
||||||
|
deque_citer operator+(typename Allocator::size_type n)
|
||||||
|
{
|
||||||
deque_citer temp(container, element + n);
|
deque_citer temp(container, element + n);
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
deque_citer & operator+=(typename Allocator::size_type n){
|
|
||||||
|
deque_citer & operator+=(typename Allocator::size_type n)
|
||||||
|
{
|
||||||
element += n;
|
element += n;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
deque_citer & operator--(){
|
|
||||||
|
deque_citer & operator--()
|
||||||
|
{
|
||||||
--element;
|
--element;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
deque_citer operator--(int){
|
|
||||||
|
deque_citer operator--(int)
|
||||||
|
{
|
||||||
deque_citer temp(container, element);
|
deque_citer temp(container, element);
|
||||||
--element;
|
--element;
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
deque_citer operator-(typename Allocator::size_type n){
|
|
||||||
|
deque_citer operator-(typename Allocator::size_type n)
|
||||||
|
{
|
||||||
deque_citer temp(container, element - n);
|
deque_citer temp(container, element - n);
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
deque_citer & operator-=(typename Allocator::size_type n){
|
|
||||||
|
deque_citer & operator-=(typename Allocator::size_type n)
|
||||||
|
{
|
||||||
element -= n;
|
element -= n;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
typename Allocator::size_type operator-(const deque_citer & d){
|
|
||||||
|
typename Allocator::size_type operator-(const deque_citer & d)
|
||||||
|
{
|
||||||
return element - d.element;
|
return element - d.element;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -450,7 +576,8 @@ namespace std{
|
|||||||
first_element = (data_size - elements) / 2;
|
first_element = (data_size - elements) / 2;
|
||||||
last_element = first_element;
|
last_element = first_element;
|
||||||
|
|
||||||
for(n=first_element ; n < last_element; ++n ){
|
for (n=first_element ; n < last_element; ++n)
|
||||||
|
{
|
||||||
a.construct(data+n, value);
|
a.construct(data+n, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -465,7 +592,8 @@ namespace std{
|
|||||||
data = a.allocate(data_size);
|
data = a.allocate(data_size);
|
||||||
first_element = data_size / 4; //Note sure how big, but let's add a little space...
|
first_element = data_size / 4; //Note sure how big, but let's add a little space...
|
||||||
last_element = first_element;
|
last_element = first_element;
|
||||||
while(first != last){
|
while (first != last)
|
||||||
|
{
|
||||||
push_back(*first);
|
push_back(*first);
|
||||||
++first;
|
++first;
|
||||||
}
|
}
|
||||||
@@ -480,13 +608,15 @@ namespace std{
|
|||||||
data = a.allocate(data_size);
|
data = a.allocate(data_size);
|
||||||
first_element = (data_size - x.elements) / 2;
|
first_element = (data_size - x.elements) / 2;
|
||||||
last_element = first_element;
|
last_element = first_element;
|
||||||
for(size_type i=0; i < x.elements; ++i){
|
for (size_type i=0; i < x.elements; ++i)
|
||||||
|
{
|
||||||
push_back(x[i]);
|
push_back(x[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T, class Allocator> deque<T, Allocator>::~deque(){
|
template<class T, class Allocator> deque<T, Allocator>::~deque()
|
||||||
|
{
|
||||||
clear();
|
clear();
|
||||||
a.deallocate(data, data_size);
|
a.deallocate(data, data_size);
|
||||||
}
|
}
|
||||||
@@ -494,41 +624,45 @@ namespace std{
|
|||||||
template<class T, class Allocator> deque<T,Allocator>& deque<T, Allocator>::
|
template<class T, class Allocator> deque<T,Allocator>& deque<T, Allocator>::
|
||||||
operator=(const deque<T,Allocator>& x)
|
operator=(const deque<T,Allocator>& x)
|
||||||
{
|
{
|
||||||
if(&x == this){
|
if (&x == this)
|
||||||
|
{
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
resize(x.elements);
|
resize(x.elements);
|
||||||
for(size_t i = 0; i < elements; ++i){
|
for (size_t i = 0; i < elements; ++i)
|
||||||
|
{
|
||||||
data[array_element(i)] = x[i];
|
data[array_element(i)] = x[i];
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T, class Allocator> template <class InputIterator> void
|
template<class T, class Allocator> template <class InputIterator> void
|
||||||
deque<T, Allocator>::assign(InputIterator first, InputIterator last)
|
deque<T, Allocator>::assign(InputIterator first, InputIterator last)
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
while(first !=last){
|
while (first !=last)
|
||||||
|
{
|
||||||
push_back(*first);
|
push_back(*first);
|
||||||
++first;
|
++first;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T, class Allocator> template <class Size, class U> void
|
template<class T, class Allocator> template <class Size, class U> void
|
||||||
deque<T, Allocator>::assign(Size n, const U& u)
|
deque<T, Allocator>::assign(Size n, const U& u)
|
||||||
{
|
{
|
||||||
if(&u == this){
|
if (&u == this)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
for(size_type i = 0; i < n; ++i){
|
for (size_type i = 0; i < n; ++i)
|
||||||
|
{
|
||||||
push_back(u);
|
push_back(u);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T, class Allocator> typename deque<T, Allocator>::allocator_type
|
template<class T, class Allocator> typename deque<T, Allocator>::allocator_type
|
||||||
deque<T, Allocator>::get_allocator() const
|
deque<T, Allocator>::get_allocator() const
|
||||||
{
|
{
|
||||||
@@ -541,7 +675,6 @@ namespace std{
|
|||||||
return deque_iter(this, 0);
|
return deque_iter(this, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T, class Allocator> typename deque<T, Allocator>::const_iterator
|
template<class T, class Allocator> typename deque<T, Allocator>::const_iterator
|
||||||
deque<T, Allocator>::begin() const
|
deque<T, Allocator>::begin() const
|
||||||
{
|
{
|
||||||
@@ -596,17 +729,22 @@ namespace std{
|
|||||||
return ((size_type)(-1)) / sizeof(T);
|
return ((size_type)(-1)) / sizeof(T);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, class Allocator> void deque<T, Allocator>::resize(size_type sz, T c){
|
template<class T, class Allocator> void deque<T, Allocator>::resize(size_type sz, T c)
|
||||||
|
{
|
||||||
reserve(sz);
|
reserve(sz);
|
||||||
while(sz > size()){
|
while (sz > size())
|
||||||
|
{
|
||||||
push_back(c);
|
push_back(c);
|
||||||
}
|
}
|
||||||
while(sz < size()){
|
|
||||||
|
while (sz < size())
|
||||||
|
{
|
||||||
pop_back();
|
pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, class Allocator> bool deque<T, Allocator>::empty() const{
|
template<class T, class Allocator> bool deque<T, Allocator>::empty() const
|
||||||
|
{
|
||||||
return (elements == 0);
|
return (elements == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -625,8 +763,13 @@ namespace std{
|
|||||||
template<class T, class Allocator> typename
|
template<class T, class Allocator> typename
|
||||||
deque<T, Allocator>::reference deque<T, Allocator>::at(size_type n)
|
deque<T, Allocator>::reference deque<T, Allocator>::at(size_type n)
|
||||||
{
|
{
|
||||||
if(n > elements){
|
if (n > elements)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_UCLIBCXX_EXCEPTION
|
||||||
__throw_out_of_range("Out of deque range");
|
__throw_out_of_range("Out of deque range");
|
||||||
|
#else
|
||||||
|
std::terminate();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return data[array_element(n)];
|
return data[array_element(n)];
|
||||||
}
|
}
|
||||||
@@ -634,8 +777,13 @@ namespace std{
|
|||||||
template<class T, class Allocator> typename
|
template<class T, class Allocator> typename
|
||||||
deque<T, Allocator>::const_reference deque<T, Allocator>::at(size_type n) const
|
deque<T, Allocator>::const_reference deque<T, Allocator>::at(size_type n) const
|
||||||
{
|
{
|
||||||
if(n > elements){
|
if (n > elements)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_UCLIBCXX_EXCEPTION
|
||||||
__throw_out_of_range("Out of deque range");
|
__throw_out_of_range("Out of deque range");
|
||||||
|
#else
|
||||||
|
std::terminate();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return data[array_element(n)];
|
return data[array_element(n)];
|
||||||
}
|
}
|
||||||
@@ -664,14 +812,16 @@ namespace std{
|
|||||||
return data[array_element(elements-1)];
|
return data[array_element(elements-1)];
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, class Allocator> void deque<T, Allocator>::push_front(const T& x){
|
template<class T, class Allocator> void deque<T, Allocator>::push_front(const T& x)
|
||||||
|
{
|
||||||
reserve(elements + 1);
|
reserve(elements + 1);
|
||||||
first_element = first_subtract(1);
|
first_element = first_subtract(1);
|
||||||
a.construct(data + first_element, x);
|
a.construct(data + first_element, x);
|
||||||
++elements;
|
++elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, class Allocator> void deque<T, Allocator>::push_back(const T& x){
|
template<class T, class Allocator> void deque<T, Allocator>::push_back(const T& x)
|
||||||
|
{
|
||||||
reserve(elements + 1);
|
reserve(elements + 1);
|
||||||
a.construct(data + last_element, x);
|
a.construct(data + last_element, x);
|
||||||
++elements;
|
++elements;
|
||||||
@@ -682,19 +832,26 @@ namespace std{
|
|||||||
deque<T, Allocator>::iterator deque<T, Allocator>::insert(iterator position, const T& x)
|
deque<T, Allocator>::iterator deque<T, Allocator>::insert(iterator position, const T& x)
|
||||||
{
|
{
|
||||||
reserve(elements+1);
|
reserve(elements+1);
|
||||||
if(position.element > (elements/2)){
|
if (position.element > (elements/2))
|
||||||
|
{
|
||||||
//Push all elements back 1
|
//Push all elements back 1
|
||||||
|
|
||||||
push_back(x);
|
push_back(x);
|
||||||
for(size_type i = elements-1; i > position.element; --i){
|
for (size_type i = elements-1; i > position.element; --i)
|
||||||
|
{
|
||||||
at(i) = at(i-1);
|
at(i) = at(i-1);
|
||||||
}
|
}
|
||||||
}else{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
//Push all elements forward 1
|
//Push all elements forward 1
|
||||||
|
|
||||||
push_front(x);
|
push_front(x);
|
||||||
for (size_type i = 0; i < position.element; ++i){
|
for (size_type i = 0; i < position.element; ++i){
|
||||||
at(i) = at(i+1);
|
at(i) = at(i+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
at(position.element) = x;
|
at(position.element) = x;
|
||||||
return deque_iter(this, position.element);
|
return deque_iter(this, position.element);
|
||||||
}
|
}
|
||||||
@@ -717,16 +874,23 @@ namespace std{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, class Allocator> void deque<T, Allocator>::pop_front(){
|
template<class T, class Allocator> void deque<T, Allocator>::pop_front()
|
||||||
if(elements == 0){
|
{
|
||||||
|
if (elements == 0)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_UCLIBCXX_EXCEPTION
|
||||||
__throw_out_of_range("deque pop_front");
|
__throw_out_of_range("deque pop_front");
|
||||||
|
#else
|
||||||
|
std::terminate();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
a.destroy(data + first_element);
|
a.destroy(data + first_element);
|
||||||
first_element = array_element(1);
|
first_element = array_element(1);
|
||||||
--elements;
|
--elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, class Allocator> void deque<T, Allocator>::pop_back(){
|
template<class T, class Allocator> void deque<T, Allocator>::pop_back()
|
||||||
|
{
|
||||||
last_element = array_element(elements - 1);
|
last_element = array_element(elements - 1);
|
||||||
a.destroy(data + last_element);
|
a.destroy(data + last_element);
|
||||||
--elements;
|
--elements;
|
||||||
@@ -735,13 +899,18 @@ namespace std{
|
|||||||
template<class T, class Allocator> typename
|
template<class T, class Allocator> typename
|
||||||
deque<T, Allocator>::iterator deque<T, Allocator>::erase(typename deque<T, Allocator>::iterator position)
|
deque<T, Allocator>::iterator deque<T, Allocator>::erase(typename deque<T, Allocator>::iterator position)
|
||||||
{
|
{
|
||||||
if(position.element > (elements /2)){
|
if (position.element > (elements /2))
|
||||||
for(size_type i = position.element; i < elements - 1; ++i){
|
{
|
||||||
|
for (size_type i = position.element; i < elements - 1; ++i)
|
||||||
|
{
|
||||||
at(i) = at(i+1);
|
at(i) = at(i+1);
|
||||||
}
|
}
|
||||||
pop_back();
|
pop_back();
|
||||||
}else{
|
}
|
||||||
for(size_type i = position.element; i > 0; --i){
|
else
|
||||||
|
{
|
||||||
|
for (size_type i = position.element; i > 0; --i)
|
||||||
|
{
|
||||||
at(i) = at(i-1);
|
at(i) = at(i-1);
|
||||||
}
|
}
|
||||||
pop_front();
|
pop_front();
|
||||||
@@ -755,18 +924,27 @@ namespace std{
|
|||||||
{
|
{
|
||||||
//Shift backwards
|
//Shift backwards
|
||||||
size_type num_move = last.element - first.element;
|
size_type num_move = last.element - first.element;
|
||||||
if( first.element > (elements - last.element) ){
|
if (first.element > (elements - last.element))
|
||||||
for(size_type i = last.element; i < elements ; ++i){
|
{
|
||||||
|
for (size_type i = last.element; i < elements ; ++i)
|
||||||
|
{
|
||||||
at(i-num_move) = at(i);
|
at(i-num_move) = at(i);
|
||||||
}
|
}
|
||||||
for(size_type i = 0; i < num_move ; ++i){
|
|
||||||
|
for (size_type i = 0; i < num_move ; ++i)
|
||||||
|
{
|
||||||
pop_back();
|
pop_back();
|
||||||
}
|
}
|
||||||
}else{
|
}
|
||||||
for(size_type i = 0; i < first.element ; ++i){
|
else
|
||||||
|
{
|
||||||
|
for (size_type i = 0; i < first.element ; ++i)
|
||||||
|
{
|
||||||
at(last.element - i - 1) = at(first.element - i - 1);
|
at(last.element - i - 1) = at(first.element - i - 1);
|
||||||
}
|
}
|
||||||
for(size_type i = 0; i < num_move ; ++i){
|
|
||||||
|
for (size_type i = 0; i < num_move ; ++i)
|
||||||
|
{
|
||||||
pop_front();
|
pop_front();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -779,26 +957,31 @@ namespace std{
|
|||||||
typename deque<T,Allocator>::size_type temp_size;
|
typename deque<T,Allocator>::size_type temp_size;
|
||||||
|
|
||||||
//Swap data pointers
|
//Swap data pointers
|
||||||
|
|
||||||
temp_data = x.data;
|
temp_data = x.data;
|
||||||
x.data = data;
|
x.data = data;
|
||||||
data = temp_data;
|
data = temp_data;
|
||||||
|
|
||||||
//Swap array sizes
|
//Swap array sizes
|
||||||
|
|
||||||
temp_size = x.data_size;
|
temp_size = x.data_size;
|
||||||
x.data_size = data_size;
|
x.data_size = data_size;
|
||||||
data_size = temp_size;
|
data_size = temp_size;
|
||||||
|
|
||||||
//Swap num array elements
|
//Swap num array elements
|
||||||
|
|
||||||
temp_size = x.elements;
|
temp_size = x.elements;
|
||||||
x.elements = elements;
|
x.elements = elements;
|
||||||
elements = temp_size;
|
elements = temp_size;
|
||||||
|
|
||||||
//Swap first_pointer
|
//Swap first_pointer
|
||||||
|
|
||||||
temp_size = x.first_element;
|
temp_size = x.first_element;
|
||||||
x.first_element = first_element;
|
x.first_element = first_element;
|
||||||
first_element = temp_size;
|
first_element = temp_size;
|
||||||
|
|
||||||
//Swap last_pointer
|
//Swap last_pointer
|
||||||
|
|
||||||
temp_size = x.last_element;
|
temp_size = x.last_element;
|
||||||
x.last_element = last_element;
|
x.last_element = last_element;
|
||||||
last_element = temp_size;
|
last_element = temp_size;
|
||||||
@@ -806,7 +989,8 @@ namespace std{
|
|||||||
|
|
||||||
template<class T, class Allocator> void deque<T, Allocator>::clear()
|
template<class T, class Allocator> void deque<T, Allocator>::clear()
|
||||||
{
|
{
|
||||||
while(elements > 0 ){
|
while (elements > 0)
|
||||||
|
{
|
||||||
pop_back();
|
pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -814,7 +998,8 @@ namespace std{
|
|||||||
|
|
||||||
template<class T, class Allocator> void deque<T, Allocator>::reserve(typename deque<T, Allocator>::size_type n)
|
template<class T, class Allocator> void deque<T, Allocator>::reserve(typename deque<T, Allocator>::size_type n)
|
||||||
{
|
{
|
||||||
if(data_size >= n){
|
if (data_size >= n)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -825,12 +1010,14 @@ namespace std{
|
|||||||
data_temp = a.allocate(size_temp);
|
data_temp = a.allocate(size_temp);
|
||||||
|
|
||||||
first_temp = (size_temp - elements) / 2;
|
first_temp = (size_temp - elements) / 2;
|
||||||
for(size_type i = 0; i < elements; ++i){
|
for (size_type i = 0; i < elements; ++i)
|
||||||
|
{
|
||||||
a.construct(data_temp + first_temp + i, data[array_element(i)]);
|
a.construct(data_temp + first_temp + i, data[array_element(i)]);
|
||||||
a.destroy(data + array_element(i));
|
a.destroy(data + array_element(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Now shuffle pointers
|
//Now shuffle pointers
|
||||||
|
|
||||||
a.deallocate(data, data_size);
|
a.deallocate(data, data_size);
|
||||||
data = data_temp;
|
data = data_temp;
|
||||||
data_size = size_temp;
|
data_size = size_temp;
|
||||||
@@ -838,7 +1025,6 @@ namespace std{
|
|||||||
last_element = first_element + elements;
|
last_element = first_element + elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class T, class Allocator> _UCXXEXPORT
|
template <class T, class Allocator> _UCXXEXPORT
|
||||||
bool
|
bool
|
||||||
operator==(const deque<T,Allocator>& x, const deque<T,Allocator>& y)
|
operator==(const deque<T,Allocator>& x, const deque<T,Allocator>& y)
|
||||||
@@ -864,16 +1050,14 @@ namespace std{
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T, class Allocator> bool operator> (const deque<T,Allocator>& x, const deque<T,Allocator>& y);
|
template <class T, class Allocator> bool operator> (const deque<T,Allocator>& x, const deque<T,Allocator>& y);
|
||||||
template <class T, class Allocator> bool operator>=(const deque<T,Allocator>& x, const deque<T,Allocator>& y);
|
template <class T, class Allocator> bool operator>=(const deque<T,Allocator>& x, const deque<T,Allocator>& y);
|
||||||
template <class T, class Allocator> bool operator<=(const deque<T,Allocator>& x, const deque<T,Allocator>& y);
|
template <class T, class Allocator> bool operator<=(const deque<T,Allocator>& x, const deque<T,Allocator>& y);
|
||||||
template <class T, class Allocator> _UCXXEXPORT void swap(deque<T,Allocator>& x, deque<T,Allocator>& y){
|
template <class T, class Allocator> _UCXXEXPORT void swap(deque<T,Allocator>& x, deque<T,Allocator>& y){
|
||||||
x.swap(y);
|
x.swap(y);
|
||||||
}
|
}
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma GCC visibility pop
|
#pragma GCC visibility pop
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -37,13 +37,16 @@
|
|||||||
|
|
||||||
CXXSRCS += algorithm.cxx associative_base.cxx bitset.cxx char_traits.cxx
|
CXXSRCS += algorithm.cxx associative_base.cxx bitset.cxx char_traits.cxx
|
||||||
CXXSRCS += complex.cxx del_op.cxx del_opnt.cxx del_opv.cxx del_opvnt.cxx
|
CXXSRCS += complex.cxx del_op.cxx del_opnt.cxx del_opv.cxx del_opvnt.cxx
|
||||||
CXXSRCS += deque.cxx exception.cxx fstream.cxx func_exception.cxx
|
CXXSRCS += deque.cxx fstream.cxx iomanip.cxx ios.cxx iostream.cxx
|
||||||
CXXSRCS += iomanip.cxx ios.cxx iostream.cxx istream.cxx iterator.cxx
|
CXXSRCS += istream.cxx iterator.cxx limits.cxx list.cxx locale.cxx
|
||||||
CXXSRCS += limits.cxx list.cxx locale.cxx map.cxx new_handler.cxx
|
CXXSRCS += map.cxx new_handler.cxx new_op.cxx new_opnt.cxx new_opv.cxx
|
||||||
CXXSRCS += new_op.cxx new_opnt.cxx new_opv.cxx new_opvnt.cxx numeric.cxx
|
CXXSRCS += new_opvnt.cxx numeric.cxx ostream.cxx queue.cxx set.cxx
|
||||||
CXXSRCS += ostream.cxx queue.cxx set.cxx sstream.cxx stack.cxx
|
CXXSRCS += sstream.cxx stack.cxx streambuf.cxx string.cxx typeinfo.cxx
|
||||||
CXXSRCS += stdexcept.cxx streambuf.cxx string.cxx typeinfo.cxx utility.cxx
|
CXXSRCS += utility.cxx valarray.cxx vector.cxx
|
||||||
CXXSRCS += valarray.cxx vector.cxx
|
|
||||||
|
ifeq ($(CONFIG_UCLIBCXX_EXCEPTION),y)
|
||||||
|
CXXSRCS += exception.cxx func_exception.cxx stdexcept.cxx
|
||||||
|
endif
|
||||||
|
|
||||||
ifneq ($(CONFIG_UCLIBCXX_HAVE_LIBSUPCXX),y)
|
ifneq ($(CONFIG_UCLIBCXX_HAVE_LIBSUPCXX),y)
|
||||||
CXXSRCS += eh_alloc.cxx eh_globals.cxx eh_terminate.cxx
|
CXXSRCS += eh_alloc.cxx eh_globals.cxx eh_terminate.cxx
|
||||||
|
|||||||
@@ -20,8 +20,6 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
|
||||||
#ifdef CONFIG_UCLIBCXX_EXCEPTION
|
|
||||||
|
|
||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
_UCXXEXPORT static terminate_handler __terminate_handler = abort;
|
_UCXXEXPORT static terminate_handler __terminate_handler = abort;
|
||||||
@@ -71,5 +69,3 @@ namespace std
|
|||||||
terminate();
|
terminate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -22,8 +22,8 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
namespace std{
|
namespace std
|
||||||
|
{
|
||||||
#ifdef CONFIG_UCLIBCXX_EXCEPTION
|
#ifdef CONFIG_UCLIBCXX_EXCEPTION
|
||||||
|
|
||||||
_UCXXEXPORT void __throw_bad_alloc()
|
_UCXXEXPORT void __throw_bad_alloc()
|
||||||
@@ -100,6 +100,4 @@ _UCXXEXPORT void __throw_invalid_argument(const char *)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
/* Copyright (C) 2004 Garrett A. Kajmowicz
|
/* Copyright (C) 2004 Garrett A. Kajmowicz
|
||||||
|
*
|
||||||
This file is part of the uClibc++ Library.
|
* This file is part of the uClibc++ Library.
|
||||||
|
*
|
||||||
This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
* License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
This library is distributed in the hope that it will be useful,
|
* This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <exception>
|
#include <exception>
|
||||||
@@ -22,42 +22,43 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_UCLIBCXX_EXCEPTION
|
#ifdef CONFIG_UCLIBCXX_EXCEPTION
|
||||||
|
|
||||||
namespace std{
|
namespace std
|
||||||
|
{
|
||||||
_UCXXEXPORT logic_error::logic_error() throw() : mstring(){
|
_UCXXEXPORT logic_error::logic_error() throw() : mstring()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
_UCXXEXPORT logic_error::logic_error(const string& what_arg) : mstring(what_arg){
|
_UCXXEXPORT logic_error::logic_error(const string& what_arg) : mstring(what_arg)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
_UCXXEXPORT const char * logic_error::what() const throw(){
|
_UCXXEXPORT const char * logic_error::what() const throw()
|
||||||
|
{
|
||||||
return mstring.c_str();
|
return mstring.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_UCXXEXPORT out_of_range::out_of_range() : logic_error()
|
||||||
_UCXXEXPORT out_of_range::out_of_range() : logic_error(){
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_UCXXEXPORT out_of_range::out_of_range(const string & what_arg) : logic_error(what_arg) {
|
_UCXXEXPORT out_of_range::out_of_range(const string & what_arg) : logic_error(what_arg)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
_UCXXEXPORT runtime_error::runtime_error() : mstring(){
|
_UCXXEXPORT runtime_error::runtime_error() : mstring()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
_UCXXEXPORT runtime_error::runtime_error(const string& what_arg) : mstring(what_arg){
|
_UCXXEXPORT runtime_error::runtime_error(const string& what_arg) : mstring(what_arg)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
_UCXXEXPORT const char * runtime_error::what() const throw(){
|
_UCXXEXPORT const char * runtime_error::what() const throw()
|
||||||
|
{
|
||||||
return mstring.c_str();
|
return mstring.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -26,10 +26,9 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|
||||||
namespace std{
|
namespace std
|
||||||
|
{
|
||||||
#ifdef __UCLIBCXX_EXPAND_STRING_CHAR__
|
#ifdef __UCLIBCXX_EXPAND_STRING_CHAR__
|
||||||
|
|
||||||
#ifdef __UCLIBCXX_EXPAND_CONSTRUCTORS_DESTRUCTORS__
|
#ifdef __UCLIBCXX_EXPAND_CONSTRUCTORS_DESTRUCTORS__
|
||||||
|
|
||||||
template _UCXXEXPORT string::basic_string(const allocator<char> &);
|
template _UCXXEXPORT string::basic_string(const allocator<char> &);
|
||||||
@@ -89,24 +88,19 @@ namespace std{
|
|||||||
template _UCXXEXPORT bool operator> (const string & lhs, const string & rhs);
|
template _UCXXEXPORT bool operator> (const string & lhs, const string & rhs);
|
||||||
template _UCXXEXPORT bool operator< (const string & lhs, const string & rhs);
|
template _UCXXEXPORT bool operator< (const string & lhs, const string & rhs);
|
||||||
|
|
||||||
|
|
||||||
// Functions dependent upon OSTREAM
|
// Functions dependent upon OSTREAM
|
||||||
|
|
||||||
#ifdef __UCLIBCXX_EXPAND_OSTREAM_CHAR__
|
#ifdef __UCLIBCXX_EXPAND_OSTREAM_CHAR__
|
||||||
|
|
||||||
template _UCXXEXPORT ostream & operator<<(ostream & os, const string & str);
|
template _UCXXEXPORT ostream & operator<<(ostream & os, const string & str);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Functions dependent upon ISTREAM
|
// Functions dependent upon ISTREAM
|
||||||
|
|
||||||
#ifdef __UCLIBCXX_EXPAND_ISTREAM_CHAR__
|
#ifdef __UCLIBCXX_EXPAND_ISTREAM_CHAR__
|
||||||
|
|
||||||
template _UCXXEXPORT istream & operator>>(istream & is, string & str);
|
template _UCXXEXPORT istream & operator>>(istream & is, string & str);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
} // namespace
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -215,6 +215,19 @@ cxxtest
|
|||||||
b. Execute 'make menuconfig' in nuttx/ in order to start the
|
b. Execute 'make menuconfig' in nuttx/ in order to start the
|
||||||
reconfiguration process.
|
reconfiguration process.
|
||||||
|
|
||||||
|
3. At presenet (2012/11/02), this example builds only with exceptions
|
||||||
|
disabled (CONFIG_UCLIBCXX_EXCEPTIONS=n). And even then, it will
|
||||||
|
not run.
|
||||||
|
|
||||||
|
The reason that the example will will not run on the simulator has
|
||||||
|
to do with when static constructors are enabled: In the simulator
|
||||||
|
it will attempt to execute the static constructros before main()
|
||||||
|
starts. BUT... NuttX is not initialized and this results in a crash.
|
||||||
|
|
||||||
|
To really use this example, I will have to think of some way to
|
||||||
|
postpone running C++ static initializers until NuttX has been
|
||||||
|
initialied.
|
||||||
|
|
||||||
mount
|
mount
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
|||||||
@@ -45,7 +45,11 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ARCHCPUFLAGS = -fno-builtin
|
ARCHCPUFLAGS = -fno-builtin
|
||||||
|
ifeq ($(CONFIG_UCLIBCXX_EXCEPTION),y)
|
||||||
ARCHCPUFLAGSXX = -fno-builtin
|
ARCHCPUFLAGSXX = -fno-builtin
|
||||||
|
else
|
||||||
|
ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions
|
||||||
|
endif
|
||||||
ARCHPICFLAGS = -fpic
|
ARCHPICFLAGS = -fpic
|
||||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
|
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
|
||||||
ARCHWARNINGSXX = -Wall -Wshadow
|
ARCHWARNINGSXX = -Wall -Wshadow
|
||||||
|
|||||||
Reference in New Issue
Block a user