throw_delegate.h
Go to the documentation of this file.
00001 //
00002 // Copyright 2017 The Abseil Authors.
00003 //
00004 // Licensed under the Apache License, Version 2.0 (the "License");
00005 // you may not use this file except in compliance with the License.
00006 // You may obtain a copy of the License at
00007 //
00008 //      https://www.apache.org/licenses/LICENSE-2.0
00009 //
00010 // Unless required by applicable law or agreed to in writing, software
00011 // distributed under the License is distributed on an "AS IS" BASIS,
00012 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013 // See the License for the specific language governing permissions and
00014 // limitations under the License.
00015 //
00016 
00017 #ifndef ABSL_BASE_INTERNAL_THROW_DELEGATE_H_
00018 #define ABSL_BASE_INTERNAL_THROW_DELEGATE_H_
00019 
00020 #include <string>
00021 
00022 namespace absl {
00023 namespace base_internal {
00024 
00025 // Helper functions that allow throwing exceptions consistently from anywhere.
00026 // The main use case is for header-based libraries (eg templates), as they will
00027 // be built by many different targets with their own compiler options.
00028 // In particular, this will allow a safe way to throw exceptions even if the
00029 // caller is compiled with -fno-exceptions.  This is intended for implementing
00030 // things like map<>::at(), which the standard documents as throwing an
00031 // exception on error.
00032 //
00033 // Using other techniques like #if tricks could lead to ODR violations.
00034 //
00035 // You shouldn't use it unless you're writing code that you know will be built
00036 // both with and without exceptions and you need to conform to an interface
00037 // that uses exceptions.
00038 
00039 [[noreturn]] void ThrowStdLogicError(const std::string& what_arg);
00040 [[noreturn]] void ThrowStdLogicError(const char* what_arg);
00041 [[noreturn]] void ThrowStdInvalidArgument(const std::string& what_arg);
00042 [[noreturn]] void ThrowStdInvalidArgument(const char* what_arg);
00043 [[noreturn]] void ThrowStdDomainError(const std::string& what_arg);
00044 [[noreturn]] void ThrowStdDomainError(const char* what_arg);
00045 [[noreturn]] void ThrowStdLengthError(const std::string& what_arg);
00046 [[noreturn]] void ThrowStdLengthError(const char* what_arg);
00047 [[noreturn]] void ThrowStdOutOfRange(const std::string& what_arg);
00048 [[noreturn]] void ThrowStdOutOfRange(const char* what_arg);
00049 [[noreturn]] void ThrowStdRuntimeError(const std::string& what_arg);
00050 [[noreturn]] void ThrowStdRuntimeError(const char* what_arg);
00051 [[noreturn]] void ThrowStdRangeError(const std::string& what_arg);
00052 [[noreturn]] void ThrowStdRangeError(const char* what_arg);
00053 [[noreturn]] void ThrowStdOverflowError(const std::string& what_arg);
00054 [[noreturn]] void ThrowStdOverflowError(const char* what_arg);
00055 [[noreturn]] void ThrowStdUnderflowError(const std::string& what_arg);
00056 [[noreturn]] void ThrowStdUnderflowError(const char* what_arg);
00057 
00058 [[noreturn]] void ThrowStdBadFunctionCall();
00059 [[noreturn]] void ThrowStdBadAlloc();
00060 
00061 // ThrowStdBadArrayNewLength() cannot be consistently supported because
00062 // std::bad_array_new_length is missing in libstdc++ until 4.9.0.
00063 // https://gcc.gnu.org/onlinedocs/gcc-4.8.3/libstdc++/api/a01379_source.html
00064 // https://gcc.gnu.org/onlinedocs/gcc-4.9.0/libstdc++/api/a01327_source.html
00065 // libcxx (as of 3.2) and msvc (as of 2015) both have it.
00066 // [[noreturn]] void ThrowStdBadArrayNewLength();
00067 
00068 }  // namespace base_internal
00069 }  // namespace absl
00070 
00071 #endif  // ABSL_BASE_INTERNAL_THROW_DELEGATE_H_


abseil_cpp
Author(s):
autogenerated on Wed Jun 19 2019 19:42:15