What is the macro for std::string/std::wstring in vc++?

According to MSDN: https://msdn.microsoft.com/en-us/library/windows/desktop/ff381407%28v=vs.85%29.aspx You can write TCHAR for char or wchar_t depend on compiler MACRO UNICODE Is there a similar symbol for std::string and std::wstring? Thanks! (My VC++ version is 2013) 你可以自己定义它: typedef basic_string<TCHAR, char_traits<TCHAR>, allocator<TCHAR> > tstring; I d

vc ++中std :: string / std :: wstring的宏是什么?

根据MSDN: https://msdn.microsoft.com/en-us/library/windows/desktop/ff381407%28v=vs.85%29.aspx 您可以编写TCHAR char或wchar_t取决于编译器MACRO UNICODE std :: string和std :: wstring是否有类似的符号? 谢谢! (我的VC ++版本是2013) 你可以自己定义它: typedef basic_string<TCHAR, char_traits<TCHAR>, allocator<TCHAR> > tstring; 我没有找到一个。 我自己在我这样的代码中写

How Can Be Used the Command Line of Developer Command Prompt in Vim on Windows?

I have Visual Studio Express for Windows Desktop installed on this laptop and I can compile a C++ source file with the command cl /EHsc filename.cpp and a C++ program that uses .NET classes with the command cl /clr filenameclr.cpp on the command line of Developer Command Prompt for VS2012 using this instructions: http://msdn.microsoft.com/en-us/library/ms235639.aspx How can I be able to compile

如何在Windows上使用Vim中开发者命令提示符的命令行?

我在此笔记本电脑上安装了用于Windows桌面的Visual Studio Express,并且可以使用命令cl /EHsc filename.cpp和使用命令cl /clr filenameclr.cpp上的.NET类的C ++程序编译C ++源文件使用此说明的开发人员命令提示符VS2012行:http://msdn.microsoft.com/en-us/library/ms235639.aspx 我如何能够使用这些命令在Microsoft Windows上的Vim(文本编辑器)中进行编译? :cl /EHsc filename.cpp和:cl /clr filenameclr.cpp不起作用。

C++ Wifi Signal Strength

I'm trying to get the strength of the connected wifi signal using c++ on a Windows 7 machine. I can get a value for the strength of the signal using the command WlanGetAvailableNetworkList but the value returned is not granular enough for our requirements. Basically as you move away from the Wifi router the value jumps in increments of 20% (99% -> 80% -> 60% etc). For the applicati

C ++ Wifi信号强度

我试图在Windows 7机器上使用c ++来获得连接的wifi信号的强度。 我可以使用命令WlanGetAvailableNetworkList信号强度的值,但返回的值对于我们的要求不够精细。 基本上,当你离开Wifi路由器时,数值以20%的增量跳跃(99% - > 80% - > 60%等)。 对于我们正在开发的应用程序,我们确实需要更准确的价值。 我知道这是可能的,因为我已经看到在窗口中显示信号强度的精确dBm值的应用程序... 如果有人有任何建议,

Mutex implementation and signaling

When a mutex is already locked by T1, and T2 tries to lock it, what is the process for T2? I think it goes something like this: -T2 tries to lock, fails, maybe spinlocks a bit, then calls yield... -T2 is scheduled for execution a couple of times, tries to lock fails, yields... -Eventually T1 unlocks, T2 is scheduled for execution and manages to lock the mutex... Does T1 unlocking explic

互斥体的实现和信号

当一个互斥锁已经被T1锁定,并且T2试图锁定它时,T2的过程是什么? 我认为它是这样的: -T2尝试锁定,失败,可能是自旋锁定,然后调用yield ... -T2计划执行几次,尝试锁定失败,产生... - 最终T1解锁,T2计划执行并设法锁定互斥锁... T1解锁是否明确向调度程序或其他线程发出互斥锁已解锁的信号? 或者它只是解锁,并让调度程序安排阻塞的线程,当它觉得适合这样做(又称调度程序没有封锁线程的概念,并不把它们视

How Google deals with errors in C++

Google does not use exception in their C++ code base. For errors, they use a class called status than the programmer must check when it is returned from a function. Otherwise the program does not compile (link https://www.youtube.com/watch?v=NOCElcMcFik at 41:34). I have a few questions: 1) Is there any example of that class on the web freely available? 2) That's okay for "void f(

Google如何处理C ++中的错误

Google不会在他们的C ++代码库中使用异常。 对于错误,他们使用称为状态的类,而不是程序员从函数返回时必须检查的类。 否则,该程序不会编译(链接https://www.youtube.com/watch?v=NOCElcMcFik在41:34)。 我有几个问题: 1)网上有免费的课程吗? 2)对于“变成f()”的副作用的“void f()”没关系。 但是如果你的函数已经返回一个值呢? Google不允许传递非常量的引用,因此您无法改变给予您的状态对象。 那么他们

Chess AI with alpha beta algorithm

I have implemented the alpha beta algorithm for my chess game, however it takes a lot of time (minutes for 4-ply) to finally make a rather stupid move. I've been trying to find the mistake (I assume I made one) for 2 days now, I would very much appreciate some outside input on my code. getMove function: is called for the root node, it calls alphaBeta function for all it's child nodes

国际象棋AI与alpha beta算法

我已经实施了我的国际象棋游戏的alpha beta算法,但是它需要很长时间(4分钟的时间)才能最终做出一个相当愚蠢的举动。 我一直在努力寻找2天内发现的错误(我假设我做了一个错误),我非常感谢我的代码的一些外部输入。 getMove函数:为根节点调用,它调用所有子节点(可能的移动)的alphaBeta函数,然后选择具有最高分数的移动。 Move AIPlayer::getMove(Board b, MoveGenerator& gen) { // defined constants: ALP

Chess Validation Move input wanted

So, I have gotten quite far in my mission to finish a chess game in c++. However, I have hit a bit of a small issue I would like to get some input on, please. SITUATION: My PAWN, KING, KNIGHT move validations work perfect. But; When moving a piece(such as a white ROOK) it follows most of the rules. For example, it will only move vertical or horizontal, it will not pass another white piece

国际象棋验证希望移动输入

所以,我完成我的使命,用c ++完成一盘棋。 但是,我想请点击一些我想获得一些意见的小问题。 情况: 我的PAWN,KING,KNIGHT移动验证工作完美。 但; 当移动一块(如白色ROOK)时,它遵循大部分规则。 例如,它只能移动垂直或水平,它不会通过另一个白色的部分,它不会取代一个白色的部分,最后它会取代黑色(相反)的部分。 问题在于,当它移过另一个黑色的部分时,它可以通过以取代通过它的部分。 所以可以说我们在

Connect Chess Engine with C++ GUI Program

I want to connect my C++ Program with a Chess Engine in order to have AI for the enemy. In my c++ program-->User will make a move(eg. A2A3)-->I will pass this string to chess engine-->engine will update board-->engine will start AI for calculating enemy move-->Engine will give enemy's move as string(eg A7A6) to my C++ program-->etc I read that in order for my program to i

将国际象棋引擎与C ++ GUI程序连接起来

我想将我的C ++程序与国际象棋引擎连接起来,以便为敌人提供AI。 在我的c ++程序中 - >用户会做出一个动作(例如A2A3) - >我会把这个字符串传给棋盘引擎 - >引擎会更新棋盘 - >引擎会启动AI来计算敌方移动 - >引擎将敌人的移动作为字符串(例如A7A6)传递给我的C ++程序 - >等等 我读到,为了让我的程序与国际象棋引擎进行交互,我必须启动chess_engine.exe文件并通过标准输入/输出与它交换命令。 你能

(Chess game)Function that returns possible moves of pawn

I'm writing a C++ chess game.I have an abstract class Piece and classes which inherit it.Class Piece has pure virtual method which returns all possible moves.But I have a problem with pawn position, because for each player pawn can move only forward, but in the board(which is matrix of Piece) forward appears different for each player.How can I implement possibleMoves() for pawns ? Thanks! c

(国际象棋游戏)返回可能的棋子移动的功能

我正在写一个C ++象棋游戏。我有一个抽象类Piece和继承它的类.Class Piece有纯粹的虚拟方法,它返回所有可能的移动。但是我有一个棋子位置的问题,因为每个棋子只能移动棋子向前,但在棋盘(这是Piece的矩阵)向前出现不同的每个player.How可以实现possibleMoves()的棋子? 谢谢! class Piece { public: Piece(std::string, char verticalPosition, char horizontalPosition); virtual std::pair<char,c

clang++ error on late default template parameter declaration

The following code compiles fine with g++, but not with clang++ (3.6): // Forward declaration: template <class S, class T> struct Base; template <class T> struct BaseFriend { friend struct Base<int, T>; }; // Actual declaration: template <class S, class T = int> struct Base { void foo() {} }; struct DerivedFriend : BaseFriend<int> {}; struct Derived : Ba

在延迟默认模板参数声明中出现clang ++错误

下面的代码用g ++编译得很好,但不能用clang ++(3.6)编译: // Forward declaration: template <class S, class T> struct Base; template <class T> struct BaseFriend { friend struct Base<int, T>; }; // Actual declaration: template <class S, class T = int> struct Base { void foo() {} }; struct DerivedFriend : BaseFriend<int> {}; struct Derived : Base<int>