有没有办法通过搜索文件中删除的文本字符串来查找SVN修订版?我知道要搜索的确切文本以及要查看的文件,但有数百个修订版.
我将VB项目重构为2个项目,其中一个是实用程序库,我想与以后的项目共享。我的解决方案的布局是这样的:
Solution
|_ util
|_ util.vb
|_ main project
|_ (main project files)
Run Code Online (Sandbox Code Playgroud)
util被创建为类库,并将成员文件添加到其中。然后,我已将util添加到主项目的引用中。但是,当我尝试从主项目文件调用util.vb中的函数时,出现如下构建错误:
error BC30451: Name 'LogException' is not declared.
error BC30002: Type 'VarFile' is not defined.
Run Code Online (Sandbox Code Playgroud)
这些在util.vb中定义,当它是主项目的一部分时,它可以很好地编译。声明看起来像这样:(我已经修剪了细节)
Imports System.IO
Public Module utils
Public Sub LogException(ByRef ex As Exception, Optional ByVal logFile As String = "", Optional ByVal logFolder As String = "")
' ...
End Sub
Public Class VarFile
' ...
End Class
End Module
Run Code Online (Sandbox Code Playgroud)
我可以将util.vb“作为链接”添加到主项目中,它将解决所有构建错误,但这似乎违反了重构类库的目的-我想单独开发该库,但并不总是有跟踪我尚未在主项目中添加的文件链接。有没有比这更好的方法了?
我有这个模板功能:
template <class P>
double Determinant(const P & a, const P & b, const P & c) {
return (b.x-a.x)*(c.y-a.y) - (c.x-a.x)*(b.y-a.y);
}
Run Code Online (Sandbox Code Playgroud)
但是我想避免一直强制返回类型double--P :: x和P :: y也可以是int,我在两种情况下都需要这个函数.有没有办法指定x和y的类型,像这样?
//doesn't compile; can't deduce template argument for T
template <typename T, class P>
T Determinant(const P & a, const P & b, const P & c) {
return (b.x-a.x)*(c.y-a.y) - (c.x-a.x)*(b.y-a.y);
}
Run Code Online (Sandbox Code Playgroud)
编辑:我的编译器是VC2005
edit2:遗憾地忘记提及:遗憾的是我不能修改P的结构的实现; 我处理的一种点类型是MFC/ATL的CPoint,它们被硬编码为{ long x; long y; }.
我有一个叫做WorkerA一个图像格式的类(让我们称它为A,它相当不标准).班级运作良好:
class WorkerA
{
public:
void Setup()
{
//some stuff specific to format A
}
void MainTask()
{
//some algorithm that calls GetPixel() a lot
}
//...
protected:
int GetPixel(int x, int y)
{
int value;
//value = ... (gets pixel value in format A)
return value;
}
unsigned char * pBitmapA;
//...
};
Run Code Online (Sandbox Code Playgroud)
现在我需要另一个处理图像格式B的类, MainTask其他一些函数是相同的WorkerA,但剩下的函数需要不同的实现.不确定这种情况下的最佳做法,我将以下内容整合在一起:
class WorkerB : public WorkerA
{
public:
void Setup()
{
//some stuff specific to format B
}
//... (other …Run Code Online (Sandbox Code Playgroud)