📄 common.h
字号:
// ==============================================================
//
// Copyright (c) 2002-2003 by Alex Vinokur.
//
// For conditions of distribution and use, see
// copyright notice in version.h
//
// ==============================================================
// ##############################################################
//
// SOFTWARE : Turing Machine (C++ Implementation)
// FILE : common.h
//
// DESCRIPTION :
// Common function etc (Declaration)
//
// ##############################################################
// ###############
#ifndef _COMMON_H
#define _COMMON_H
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <iterator>
#include <numeric>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <assert.h>
using namespace std;
#include "macro.h"
// ===================
unsigned int is_udec (char * const str_i);
unsigned int is_dec (char * const str_i);
unsigned int is_hex (char * const str_i);
// ===================
template <typename T>
string to_string (
const T& value_i,
int width_i = -1,
char fill_i = ' ',
bool align_i = true, // true - left
const string& prefix_i = string ()
)
{
string ret_string_value;
ostringstream tmp_osstr;
// =================================
tmp_osstr << prefix_i;
if (width_i > 0)
{
tmp_osstr << setw (width_i);
tmp_osstr << setfill (fill_i);
}
tmp_osstr << (align_i ? left : right) << value_i;
// =================================
ret_string_value = tmp_osstr.str();
// =================================
return ret_string_value;
} // string to_string (T value_i)
#endif // _COMMON_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -