Hello everyone,
In Bjarne's book, it is mentioned that sort of STL may throw exception, like sorting elements in a vector.
In what situation will sort throw exception? I can not find a case.
thanks in advance,
George
5 1942
Where does he mention it??
The sort should not throw although exceptions can be thrown by predicates. You should always presume exceptions whenever you use STL algorithms.
Hi weaknessforcats,
You can refer to his book, appendix E, Standard-Library Exception Safety, in the 1st sample in E.1 (Introduction).
Where does he mention it??
The sort should not throw although exceptions can be thrown by predicates. You should always presume exceptions whenever you use STL algorithms.
regards,
George
[
You can refer to his book, appendix E, Standard-Library Exception Safety, in the 1st sample in E.1 (Introduction).
He doesn't say that the sort throws an exception.
What is does say is that the code that compares two objects can throw an exception.
There's a difference.
It all comes down to using try/catch blocks liberally when writing C++. To not do that just invites a crash.
Thanks weaknessforcats,
My question is answered.
[
He doesn't say that the sort throws an exception.
What is does say is that the code that compares two objects can throw an exception.
There's a difference.
It all comes down to using try/catch blocks liberally when writing C++. To not do that just invites a crash.
regards,
George
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Kerri |
last post by:
Hi,
I am new to .NET
In my Error Logic on my Aspx pages when an error happens
it hits my catch statement where I throw an Exception.
My question is :
what is the difference between Thwo...
|
by: Pierre Rouleau |
last post by:
The std::exception class defined in the Standard C++ <exception> header
specifies that the constructors could throw any exception becuase they
do not have a throw() specification.
Why is that? ...
|
by: hplloyd |
last post by:
Hi,
I have a function that adds data to a database and I want to return true if
the database was updated and false if there was a problem, so I am using a
try... catch block...
My problem is...
|
by: Arjen |
last post by:
Hi,
I'm reading the enterprise library documentation and there I see the throw
statement.
try
{
// run code
}
catch(Exception ex)
{
|
by: Gunjan Garg |
last post by:
Hello All,
I am working to create a generic datagrid which accepts a
datasource(ListData - This is our own datatype) and depending on the calling
program customizes itself for sorting,...
| |
by: Paul van Brenk |
last post by:
When you run the Shuffle method often enough it will throw exception.
And I can't figure out why.
Anybody?
Paul van Brenk
the code:
static void Shuffle(){
int ints = { 1, 2, 3, 4, 5, 6,...
|
by: Henryk |
last post by:
I did a lot of delphi GUI programming recently.
In my experience most of the time you just want to throw a standard
exception with a descriptive message. Then all calling functions can
handle...
|
by: Jess |
last post by:
Hello,
It is said that if I implement a "swap" member function, then it
should never throw any exception. However, if I implement "swap" non-
member function, then the restriction doesn't...
|
by: George2 |
last post by:
Hello everyone,
In Bjarne's book, it is mentioned that sort of STL may throw
exception, like sorting elements in a vector.
In what situation will sort throw exception? I can not find a case....
|
by: jason.cipriani |
last post by:
Consider this program, which defines a template class who's template
parameter is the type of an exception that can be thrown by members of
the class:
=== BEGIN EXAMPLE ===
#include...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |