y3c-stl 0.3.3
Friendly C++ STL wrapper with automatic stacktrace
Loading...
Searching...
No Matches
y3c::internal Namespace Reference

Namespaces

namespace  type_name
 
namespace  what
 

Classes

class  contiguous_iterator
 array, vector など各種コンテナのイテレータ More...
 
class  exception_base
 y3cの例外クラスのベース。 More...
 
class  life
 オブジェクトのライフタイムを管理するクラス More...
 
class  life_observer
 ライフタイムの状態を観測するクラス More...
 
class  life_state
 
struct  life_validator
 
struct  skip_trace_tag
 
struct  terminate_detail
 
class  ub_access_deleted
 
class  ub_access_nullptr
 
class  ub_invalid_iter
 
class  ub_iter_after_end
 
class  ub_iter_before_begin
 
class  ub_out_of_range
 
class  ub_wrong_iter
 

Enumerations

enum class  terminate_type {
  exception , terminate , internal , ub_out_of_range ,
  ub_access_nullptr , ub_access_deleted , ub_wrong_iter , ub_invalid_iter ,
  ub_iter_after_end , ub_iter_before_begin
}
 

Functions

template<typename element_type >
element_type * unwrap (const contiguous_iterator< element_type > &wrapper) noexcept
 
template<typename T >
bool operator== (const contiguous_iterator< T > &lhs, const contiguous_iterator< T > &rhs)
 
template<typename T >
bool operator!= (const contiguous_iterator< T > &lhs, const contiguous_iterator< T > &rhs)
 
template<typename T >
bool operator< (const contiguous_iterator< T > &lhs, const contiguous_iterator< T > &rhs)
 
template<typename T >
bool operator> (const contiguous_iterator< T > &lhs, const contiguous_iterator< T > &rhs)
 
template<typename T >
bool operator<= (const contiguous_iterator< T > &lhs, const contiguous_iterator< T > &rhs)
 
template<typename T >
bool operator>= (const contiguous_iterator< T > &lhs, const contiguous_iterator< T > &rhs)
 
void link () noexcept
 
void handle_final_terminate_message () noexcept
 
void do_terminate_with (terminate_detail &&detail)
 例外を表示して強制終了する
 
template<typename... Args, typename = skip_trace_tag>
void terminate_ub_out_of_range (std::string func, Args &&...args)
 
template<typename... Args, typename = skip_trace_tag>
void terminate_ub_access_nullptr (std::string func, Args &&...args)
 
template<typename... Args, typename = skip_trace_tag>
void terminate_ub_access_deleted (std::string func, Args &&...args)
 
template<typename... Args, typename = skip_trace_tag>
void terminate_ub_wrong_iter (std::string func, Args &&...args)
 
template<typename... Args, typename = skip_trace_tag>
void terminate_ub_invalid_iter (std::string func, Args &&...args)
 
template<typename... Args, typename = skip_trace_tag>
void terminate_ub_iter_after_end (std::string func, Args &&...args)
 
template<typename... Args, typename = skip_trace_tag>
void terminate_ub_iter_before_begin (std::string func, Args &&...args)
 
void terminate_internal (std::string func, std::string what, skip_trace_tag={})
 
template<typename T >
const std::string & get_type_name ()
 
void strip_and_print_trace (std::ostream &stream, cpptrace::stacktrace &trace)
 
void print_header (std::ostream &stream)
 
void print_what (std::ostream &stream, const char *func, const char *what, bool quote=false)
 
void print_maybe_inaccurate (std::ostream &stream)
 
void print_y3c_exception (std::ostream &stream, const terminate_detail &e)
 
void print_current_exception (std::ostream &stream, std::exception_ptr current, skip_trace_tag={})
 

Variables

bool throw_on_terminate
 

Enumeration Type Documentation

◆ terminate_type

enum class terminate_type
strong
Enumerator
exception 
terminate 
internal 
ub_out_of_range 
ub_access_nullptr 
ub_access_deleted 
ub_wrong_iter 
ub_invalid_iter 
ub_iter_after_end 
ub_iter_before_begin 

Function Documentation

◆ do_terminate_with()

void do_terminate_with ( terminate_detail &&  detail)

例外を表示して強制終了する

内部ではstd::terminate()ではなくstd::abort()を呼んでいる

◆ get_type_name()

template<typename T >
const std::string & get_type_name ( )

◆ handle_final_terminate_message()

void handle_final_terminate_message ( )
noexcept

これが std::set_terminate() に自動的に登録され、 例外がcatchされずterminateした時にメッセージを出してくれる。

◆ link()

void link ( )
noexcept

◆ operator!=()

template<typename T >
bool operator!= ( const contiguous_iterator< T > &  lhs,
const contiguous_iterator< T > &  rhs 
)

◆ operator<()

template<typename T >
bool operator< ( const contiguous_iterator< T > &  lhs,
const contiguous_iterator< T > &  rhs 
)

◆ operator<=()

template<typename T >
bool operator<= ( const contiguous_iterator< T > &  lhs,
const contiguous_iterator< T > &  rhs 
)

◆ operator==()

template<typename T >
bool operator== ( const contiguous_iterator< T > &  lhs,
const contiguous_iterator< T > &  rhs 
)

◆ operator>()

template<typename T >
bool operator> ( const contiguous_iterator< T > &  lhs,
const contiguous_iterator< T > &  rhs 
)

◆ operator>=()

template<typename T >
bool operator>= ( const contiguous_iterator< T > &  lhs,
const contiguous_iterator< T > &  rhs 
)

◆ print_current_exception()

void print_current_exception ( std::ostream &  stream,
std::exception_ptr  current,
skip_trace_tag  = {} 
)

◆ print_header()

void print_header ( std::ostream &  stream)

◆ print_maybe_inaccurate()

void print_maybe_inaccurate ( std::ostream &  stream)

◆ print_what()

void print_what ( std::ostream &  stream,
const char *  func,
const char *  what,
bool  quote = false 
)

◆ print_y3c_exception()

void print_y3c_exception ( std::ostream &  stream,
const terminate_detail e 
)

◆ strip_and_print_trace()

void strip_and_print_trace ( std::ostream &  stream,
cpptrace::stacktrace &  trace 
)

◆ terminate_internal()

void terminate_internal ( std::string  func,
std::string  what,
skip_trace_tag  = {} 
)
inline

◆ terminate_ub_access_deleted()

template<typename... Args, typename = skip_trace_tag>
void terminate_ub_access_deleted ( std::string  func,
Args &&...  args 
)

◆ terminate_ub_access_nullptr()

template<typename... Args, typename = skip_trace_tag>
void terminate_ub_access_nullptr ( std::string  func,
Args &&...  args 
)

◆ terminate_ub_invalid_iter()

template<typename... Args, typename = skip_trace_tag>
void terminate_ub_invalid_iter ( std::string  func,
Args &&...  args 
)

◆ terminate_ub_iter_after_end()

template<typename... Args, typename = skip_trace_tag>
void terminate_ub_iter_after_end ( std::string  func,
Args &&...  args 
)

◆ terminate_ub_iter_before_begin()

template<typename... Args, typename = skip_trace_tag>
void terminate_ub_iter_before_begin ( std::string  func,
Args &&...  args 
)

◆ terminate_ub_out_of_range()

template<typename... Args, typename = skip_trace_tag>
void terminate_ub_out_of_range ( std::string  func,
Args &&...  args 
)

◆ terminate_ub_wrong_iter()

template<typename... Args, typename = skip_trace_tag>
void terminate_ub_wrong_iter ( std::string  func,
Args &&...  args 
)

◆ unwrap()

template<typename element_type >
element_type * unwrap ( const contiguous_iterator< element_type > &  wrapper)
noexcept

Variable Documentation

◆ throw_on_terminate

bool throw_on_terminate
Initial value:
=
(std::set_terminate(handle_final_terminate_message), false)

通常は terminate(), undefined_behavior() で std::terminate()を呼んで強制終了するが、 これがtrueの場合代わりにthrowするようになる (主にテスト用)

投げた例外がdll境界を越えるとMacOSでめんどくさいことになるので、 例外はinline関数の中で投げる