This repository has been archived by the owner on Jun 6, 2024. It is now read-only.
forked from vector-of-bool/pmm
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0361440
commit 1736591
Showing
6 changed files
with
70 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// cotire example project | ||
|
||
#include "example.h" | ||
|
||
#ifndef NDEBUG | ||
#include <algorithm> | ||
#include <iterator> | ||
#endif | ||
|
||
namespace example { | ||
|
||
std::string get_message() { | ||
char msg_chrs[] = { 'C', 'o', 't', 'i', 'r', 'e', 'd', '!' }; | ||
#ifdef NDEBUG | ||
return std::string(&msg_chrs[0], &msg_chrs[sizeof(msg_chrs)]); | ||
#else | ||
std::string msg; | ||
msg.reserve(sizeof(msg_chrs)); | ||
std::copy(msg_chrs, msg_chrs + sizeof(msg_chrs), std::back_inserter(msg)); | ||
return msg; | ||
#endif | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// cotire example project | ||
|
||
#include <string> | ||
|
||
namespace example { | ||
|
||
std::string get_message(); | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// cotire example project | ||
|
||
#include "log.h" | ||
|
||
#include <iostream> | ||
|
||
namespace logging { | ||
|
||
void error(const std::string& msg) { | ||
std::cerr << msg << std::endl; | ||
} | ||
|
||
void info(const std::string& msg) { | ||
std::cout << msg << std::endl; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// cotire example project | ||
|
||
#include <string> | ||
|
||
namespace logging { | ||
|
||
void error(const std::string& msg); | ||
void info(const std::string& msg); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
#include <iostream> | ||
using namespace std; | ||
// cotire example project main | ||
|
||
#include <string> | ||
|
||
#include "example.h" | ||
#include "log.h" | ||
|
||
int main() | ||
{ | ||
cout << "Hello, World!"; | ||
return 0; | ||
std::string msg = example::get_message(); | ||
logging::info(msg); | ||
} |