小编Art*_*wan的帖子

VBA集合:密钥列表

在我向VBA集合添加一些值之后,有没有办法保留所有键的列表?

例如

Dim coll as new  Collection
Dim str1, str2, str3
str1="first string"
str2="second string"
str3="third string"
coll.add str1, "first key"
coll.add str2, "second key"
coll.add str3, "third key"
Run Code Online (Sandbox Code Playgroud)

我知道如何保留字符串列表:

first string
second string
third string
Run Code Online (Sandbox Code Playgroud)

再一次:有没有办法保留钥匙?

first key
second key
third key
Run Code Online (Sandbox Code Playgroud)

注意:我正在通过AutoCAD 2007使用VBA

collections vba

43
推荐指数
5
解决办法
15万
查看次数

"char"和"small int"比"int"慢吗?

可能重复:
内置类型的性能:char vs short vs int vs. float vs. double

你好.假设您有32位处理器.8位char和16位short int类型比原生32位慢int吗?那么使用64位long long int呢?

默认情况下硬件是否支持此数据类型,或者通过使用其他指令将它们全部转换为32位数据?

如果我必须存储少量的字符,将它们存储为整数是不是更快?

c c++ compiler-construction processor

8
推荐指数
1
解决办法
7959
查看次数

C/C++:GOTO比WHILE和FOR更快吗?

我知道,每个人都讨厌GOTO,没有人推荐它.但那不是重点.我只想知道,哪个代码最快:

  1. goto

    int i=3;
    loop:
    printf("something");
    if(--i) goto loop;
    
    Run Code Online (Sandbox Code Playgroud)
  2. while

    int i=3;
    while(i--) {
        printf("something");
    }
    
    Run Code Online (Sandbox Code Playgroud)
  3. for

    for(int i=3; i; i--) {
        printf("something");
    }
    
    Run Code Online (Sandbox Code Playgroud)

c performance loops goto

8
推荐指数
3
解决办法
8870
查看次数

派生异常不会继承构造函数

我的代码有问题.

#include <iostream>
#include <stdexcept>

class MyException : public std::logic_error {
};

void myFunction1() throw (MyException) {
    throw MyException("fatal error");
};

void myFunction2() throw (std::logic_error) {
    throw std::logic_error("fatal error");
};

int main() {
    try {
        myFunction1();
        //myFunction2();
    }catch (std::exception &e) {
        std::cout << "Error.\n"
            << "Type: " << typeid(e).name() << "\n"
            << "Message: " << e.what() << std::endl;
    }
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

throw MyException("fatal error");线不起作用.Microsoft Visual Studio 2012说:

error C2440: '<function-style-cast>' : cannot convert from 'const char [12]' to …
Run Code Online (Sandbox Code Playgroud)

c++ oop inheritance constructor exception

5
推荐指数
1
解决办法
2119
查看次数

Autocad的更好的VBA编辑器

我正在Autocad中开发一些VBA宏.内置编辑器已经过时,但我无法找到更好的方法来编辑.dvb文件.

一个.dvb文件包含许多其他源文件,到目前为止我认为Autocad是唯一可以解压缩它们的软件...

它似乎能够做到这一点的唯一方法是从.dvb手动导出每个文件; 但由于我在那里有大约30个文件,所以看起来这不是一个很好的做事方式.

关于如何做得更好的任何想法?

vba editor autocad

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