//==============================================================================
//  Component:
//      STD (C++ Standard Library)
//
//  Library:
//      $KW; $FN; $EKW;
//      $KW; $Own; $Ver; $ChkD; $EKW;
//
//  Purpose:
//
//  Copyright (C) 1998-2001, Interstron, Ltd.
//  All rights reserved.
//==###=========================================================================

#ifndef __IS_STD_NEW
#define __IS_STD_NEW

#include <cstddef>
#include <exception>

_NS_STD_BEGIN

class bad_alloc : public exception
{
public:
    bad_alloc() throw() { }

    bad_alloc(const bad_alloc& rhs)
        : exception(rhs)
    { }

    virtual ~bad_alloc() throw() { }

    bad_alloc& operator=(const bad_alloc& rhs)
    {
        exception::operator=(rhs);
        return *this;
    }

    virtual const char* what() const throw()
    {
        return "An allocation function fails to allocate storage";
    }
};

struct nothrow_t {};
extern const nothrow_t nothrow;

typedef void (*new_handler)();
new_handler set_new_handler(new_handler) throw();

_NS_STD_END


void* operator new(std::size_t) throw(std::bad_alloc);
void* operator new(std::size_t, const std::nothrow_t&) throw();

void  operator delete(void*) throw();
void  operator delete(void*, const std::nothrow_t&) throw();

void* operator new[](std::size_t) throw(std::bad_alloc);
void* operator new[](std::size_t, const std::nothrow_t&) throw();

void  operator delete[](void*) throw();
void  operator delete[](void*, const std::nothrow_t&) throw();

inline void*
operator new(std::size_t, void* ptr) throw()
{
    return ptr;
}

inline void*
operator new[](std::size_t, void* ptr) throw()
{
    return ptr;
}

inline void
operator delete(void*, void*) throw()
{
}

inline void
operator delete[](void*, void*) throw()
{
}

#endif // __IS_STD_NEW

//==###=========================================================================
//  End of module:
//      $KW; $FN; $EKW;
//==============================================================================
