小编man*_*tta的帖子

当我进入团队资源管理器并单击"更改"时VS2013崩溃

我的VS2013安装从未发生任何崩溃,但本周它在启动时开始显示此错误:

An exception has been encountered. This may be caused by an extension. You can get more information by bexamining the file (...)\AppData\Roaming\Microsoft\VisualStudio\12.0\ActivityLog.xml
Run Code Online (Sandbox Code Playgroud)

然后它正确打开,我可以正常工作.但是,当我尝试提交本地更改并打开团队资源管理器并单击CHanges时,Visual Studio崩溃.

我调查了ActivityLog.xml并发现了这个错误:

<entry>
<record>179</record>
<time>2015/02/27 17:51:35.065</time>
<type>Error</type>
<source>Editor or Editor Extension</source>
<description>System.IO.IOException: The file exists.&#x000D;&#x000A;&#x000D;&#x000A;   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)&#x000D;&#x000A;   
at System.IO.__Error.WinIOError()&#x000D;&#x000A;   
at System.IO.Path.InternalGetTempFileName(Boolean checkHost)&#x000D;&#x000A;   
at Microsoft.VisualStudio.Text.Utilities.WpfHelper.LoadCursorDPIAware(Stream cursorStream)&#x000D;&#x000A;   
at Microsoft.VisualStudio.Text.Editor.Implementation.LeftSelectionMargin.get_RightArrowCursor()&#x000D;&#x000A;   
at Microsoft.VisualStudio.Text.Editor.Implementation.LeftSelectionMarginProvider.CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin)&#x000D;&#x000A;   
at Microsoft.VisualStudio.Text.Utilities.ContainerMargin.&lt;AddMargins&gt;b__2(IWpfTextViewMarginProvider mp)&#x000D;&#x000A;   
at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.InstantiateExtension[TExtension,TMetadata,TExtensionInstance](Object errorSource, Lazy`2 provider, Func`2 getter)</description>

</entry>
Run Code Online (Sandbox Code Playgroud)

我尝试删除我的所有项目,再次克隆它们,这仍然存在.任何人都可以帮我解决这个问题吗?

visual-studio visual-studio-2013

13
推荐指数
1
解决办法
1230
查看次数

函数模板返回类型推导

我有一些类Cconst和非const一些泛型类型干将Node:

template <typename NodeType>
class CParent{};

class Node {};

class C : public CParent<Node> {
    Node&       getNode(Index i);
    const Node& getNode(Index i) const;
};
Run Code Online (Sandbox Code Playgroud)

现在我想创建一个调用getNode类对象的别名函数C:

template <class CType>
NodeType& AliasGetNode(CType* cobject);
Run Code Online (Sandbox Code Playgroud)

但是我如何演绎NodeType呢?也就是说,如果我叫AliasGetNode<const C>(c)AliasGetNode<C>(c),NodeType应分别为const Node&Node&.

我怎样才能做到这一点?

我试过result_ofdecltype方法,但都没有成功.

c++ templates c++11 c++14

11
推荐指数
4
解决办法
5938
查看次数

OpenGL将最近世界3D的3D坐标指向当前鼠标位置

在OpenGL上下文中,我已经看到可以将鼠标坐标转换为3D世界坐标(例如,带有Opengl的MFC从鼠标的2d坐标获得3d坐标).但是,当我只有一组GLPoints和大量空白空间时,这不起作用:当我将鼠标悬停在空白区域时,3D坐标没有任何意义.

如何获取最近的3D点到我鼠标位置的坐标?

c++ opengl 3d mouse-picking

7
推荐指数
1
解决办法
1218
查看次数

非模板类中的模板构造函数

我有以下类定义:

class image {

public:

  template <class T> image(int w, int h);
  virtual ~image();

  void clear();
};

template <class T> image::image(int w, int h) {
  ...
  ...
}
Run Code Online (Sandbox Code Playgroud)

构造函数在同一个头文件中定义.现在,我如何实例化这个类的对象?

我试过这个

image a<float>(128, 128);
Run Code Online (Sandbox Code Playgroud)

但得到以下错误

error: expected initializer before '<' token
image a<float>(128, 128);
Run Code Online (Sandbox Code Playgroud)

我该怎么做呢?

c++ templates

7
推荐指数
0
解决办法
2160
查看次数

opencv euclidean clustering vs findContours

我有以下图像掩码:

面具

我想应用类似的东西cv::findContours,但该算法只加入相同组中的连接点.我想用一些公差做这个,即我想在给定的半径公差内添加彼此靠近的像素:这类似于欧几里德距离层次聚类.

这是在OpenCV中实现的吗?或者有没有快速的方法来实现这个?

我想要的是类似的东西,

http://www.pointclouds.org/documentation/tutorials/cluster_extraction.php

应用于此蒙版的白色像素.

谢谢.

c++ opencv cluster-analysis

7
推荐指数
1
解决办法
3412
查看次数

在 Kotlin 中锁定互斥体的正确方法

我想使用 Kotlin 协程实现一个简单的线程安全 Buffer,因为项目中已经使用了协程。

该缓冲区将在多线程和单线程上下文中使用,因此suspend fun getMostRecentData()似乎不太合理(请参见下面的代码)。

这是我到目前为止所拥有的。事实上,我必须编写所有代码来锁定互斥体,这让我想知道我是否做错了什么。

无论如何,这是代码:

class SafeBuffer(
    private val dispatcher: CoroutineDispatcher,
    private val bufferSize: Int
    ) {

    private val buffer = LinkedList<MyDataType>()
    private val mutex = Mutex()

    val size: Int
        get() = buffer.size

   // First approach: make a suspend fun
   // Not great because I will need a runBlocking{} statement somewhere, every time I want to access the buffer
   suspend fun getMostRecentData() : MyDataType? {
        mutex.withLock {
            return if (buffer.isEmpty()) null else buffer.last
        } …
Run Code Online (Sandbox Code Playgroud)

kotlin kotlin-coroutines

7
推荐指数
1
解决办法
1万
查看次数

c++ shared_ptr from char*to void*

I am trying to pass a char * string to a function which will execute inside a thread. The function has the following prototype:

void f(void *ptr);
Run Code Online (Sandbox Code Playgroud)

The thread allocation is made by a function similar to the following:

void append_task(std::function<void(void *)> &f, void *data);
Run Code Online (Sandbox Code Playgroud)

I want to allocate a string that will be used inside the thread. Right Now I have this:

string name = "random string";
char *str = new char[name.length()];
strcpy(str, name.c_str());
append_task(f, static_cast<void *>(str));
Run Code Online (Sandbox Code Playgroud)

我想放弃手动分配和释放内存的义务.我怎么能这样做std::shared_ptr …

c++ multithreading

4
推荐指数
1
解决办法
447
查看次数

在 Retina 显示器中带有 QOpenGLWIdget 的 Qt MainWindow 显示错误的大小

我有一个带有MainWindow.

QOpenGLWidget在其中嵌入了一个。一切正常,直到我开始使用 Apple Retina 显示器并在高 DPI 模式下运行我的应用程序:我QOpenGLWidget的尺寸只有它应该具有的尺寸的 1/4(即,它只填充了它所在区域的左下角部分)应该填)。这个小部件显示原始 OpenGL 数据(实际上是一个 OpenSceneGraph 上下文)

我能做些什么来解决这个问题?

c++ opengl macos qt

4
推荐指数
1
解决办法
1409
查看次数

#define函数参数c ++

我在一个公共接口中调用了一组函数,并将这些函数指针存储在一个公共容器中,所以我有

typedef void(*CommandFunction)(const InputArgsMap &, const ArgumentMap *);
Run Code Online (Sandbox Code Playgroud)

有了这个说,如果没有复制粘贴参数列表,声明这种类型的函数的最佳方法是什么?我想通过a实现这个#define,但还有其他(更好的,oop)方式吗?

例如,是否可以做类似的事情

#define CMD_ARGS (const InputArgsMap &, const ArgumentMap *)
void _fcn_1(CMD_ARGS);
void _fnc_2(CMD_ARGS);
Run Code Online (Sandbox Code Playgroud)

c++

3
推荐指数
1
解决办法
106
查看次数

构建PCL:pcl_kdtree'.serialize的左边必须有class/struct/union'

我正在使用VisualStudio 2013为Windows 7编译PCL,我遇到错误include/flann/util/serialization.h:

error C2228: left of '.serialize' must have class/struct/union  D:\Libs\PCL\flann\include\flann\util\serialization.h    18  1   pcl_kdtree
Run Code Online (Sandbox Code Playgroud)

Serializing包含有关FLANN库的char*的结构中存在类似错误 .

我正在使用PCL的git,Boost 1.57,flann 1.8.1,Visual Studio 2013 x64的头版本.

这有什么问题?

c++ boost point-cloud-library

3
推荐指数
1
解决办法
1742
查看次数