// new standard header -*-c++-*-
// Copyright 2003-2020 IAR Systems AB. 
#ifndef _DLIB5_NEW_
#define _DLIB5_NEW_

#ifndef _SYSTEM_BUILD
#pragma system_include
#endif

#include <dlib5/exception>
#ifdef _LIBCPP
  #include <../libcpp/new>
#else // !_LIBCPP
  #include <../cpp/new>
#endif // _LIBCPP

_DLIB5_BEGIN

// CLASS bad_alloc
class bad_alloc
  : public exception
{       // base of all bad allocation exceptions
public:
  bad_alloc(const char *_Message = _MESG("bad allocation")) _THROW0()
    : exception(_Message)
  {       // construct from message string
  }

  //  virtual ~bad_alloc() _THROW0()
  //  {} // destroy the object
  #if _HAS_EXCEPTIONS
  #else /* _HAS_EXCEPTIONS */

    protected:
      virtual void _Doraise() const
      {       // perform class-specific exception handling
        _RAISE(*this);
      }
  #endif /* _HAS_EXCEPTIONS */
};

_DLIB5_END

#endif /* _NEW_ */

/*
 * Copyright (c) 1992-2009 by P.J. Plauger.  ALL RIGHTS RESERVED.
 * Consult your license regarding permissions and restrictions.
V5.04:0576 */
