Thrill  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
die.cpp
Go to the documentation of this file.
1 /*******************************************************************************
2  * tlx/die.cpp
3  *
4  * Part of tlx - http://panthema.net/tlx
5  *
6  * Copyright (C) 2016-2017 Timo Bingmann <[email protected]>
7  *
8  * All rights reserved. Published under the Boost Software License, Version 1.0
9  ******************************************************************************/
10 
11 #include <tlx/die.hpp>
12 
13 #include <iostream>
14 #include <sstream>
15 
16 namespace tlx {
17 
18 void die_with_message(const std::string& msg) {
19  std::cerr << msg << std::endl;
20  std::terminate();
21 }
22 
23 void die_with_message(const char* msg, const char* file, size_t line) {
24  std::ostringstream oss;
25  oss << msg << " @ " << file << ':' << line;
26  die_with_message(oss.str());
27 }
28 
29 void die_with_message(const std::string& msg, const char* file, size_t line) {
30  return die_with_message(msg.c_str(), file, line);
31 }
32 
33 } // namespace tlx
34 
35 /******************************************************************************/
void die_with_message(const std::string &msg)
die with message - either throw an exception or die via abort()
Definition: die.cpp:18
std::basic_string< char, std::char_traits< char >, Allocator< char > > string
string with Manager tracking
Definition: allocator.hpp:220