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
#include <iostream> | |
#include <string> | |
#include <chrono> | |
void tolower1(std::string& s) | |
{ | |
for (auto& c : s) | |
{ | |
if (c <= 'Z' && c >= 'A') | |
c = c - ('Z' - 'z'); |
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
#include <experimental\filesystem> | |
#include <iostream> | |
#include <fstream> | |
using namespace std; | |
using namespace std::experimental::filesystem; | |
int main(int argc, char* argv[]) | |
{ | |
if (argc < 2) |
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
#include <iostream> | |
#include <string> | |
#include <map> | |
#include <type_traits> | |
#include <typeinfo> | |
#ifndef _MSC_VER | |
# include <cxxabi.h> | |
#endif | |
#include <memory> |
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
#include <string> | |
#include <future> | |
#include <vector> | |
#include <sstream> | |
#include <iostream> | |
class Unit | |
{ | |
public: | |
Unit() { } |
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
#include <iostream> | |
#include <vector> | |
int main(int argc, char* argv[]) | |
{ | |
std::vector<int> v = {1, 2, 3, 4, 5}; | |
for (auto iter = v.rbegin(); iter != v.rend(); ++iter) | |
{ | |
std::cout << *iter << '\n'; |
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
#include <iostream> | |
#include <type_traits> | |
class Foo { | |
int v1; | |
double v2; | |
public: | |
Foo(int n) : v1(n), v2() {} | |
Foo(int n, double f) noexcept : v1(n), v2(f) {} | |
}; |
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
#include <utility> | |
#include <iostream> | |
struct Default { int foo() const { return 1; } }; | |
struct NonDefault | |
{ | |
NonDefault(const NonDefault&) { } | |
int foo() const { return 1; } | |
}; |
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
#include <algorithm> | |
#include <cctype> | |
#include <chrono> | |
#include <fstream> | |
#include <iostream> | |
#include <map> | |
#include <random> | |
#include <string> | |
#include <vector> |
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
std::wstring ReplaceWCSWithPattern(__in const std::wstring &message, __in const std::wstring &pattern, __in const std::wstring &replace) | |
{ | |
std::wstring result = message; | |
std::wstring::size_type pos = 0; | |
std::wstring::size_type offset = 0; | |
while ((pos = result.find(pattern, offset)) != std::wstring::npos) | |
{ | |
result.replace(result.begin() + pos, result.begin() + pos + pattern.size(), replace); | |
offset = pos + replace.size(); |
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
//! | |
//! \brief Returns the absolute minimum value among the elements in std::array. | |
//! | |
//! \param[in] arr The array. | |
//! | |
//! \tparam T Value type. | |
//! | |
//! \return The absolute minimum. | |
//! | |
template <typename T, int N> |
OlderNewer