小编Hem*_*thi的帖子

通过vs看看旁边

假设有2个缓存L1和L2

  • L1
    • 命中率L1 = 0.8
    • 访问时间l1 = 2ns
    • 和传输时间b/w L1和CPU是10ns
  • L2
    • 命中率L2 = 0.9
    • 访问时间L2 = 5ns
    • 传输时间b/w L2和L1为100ns

在查看和旁听政策的情况下,有效访问时间是多少.

memory caching cpu-architecture

6
推荐指数
1
解决办法
5473
查看次数

用不同的参数复制c ++中的构造函数

为什么这个代码在传递的对象不是Line类型时调用复制构造函数,并且没有等于operator/explicit调用.A行和A行()之间有区别吗?
我从许多在线教程中读到它应该是Line类型.我是C++的新手.请帮忙

 #include <iostream>
    using namespace std;

class Line
{
   public:
      int getLength( void );
      Line( int len );             // simple constructor
      Line( const Line &obj);  // copy constructor
      ~Line();                     // destructor

   private:
      int *ptr;
};

// Member functions definitions including constructor
Line::Line(int len)
{
    cout << "Normal constructor allocating ptr" << endl;
    // allocate memory for the pointer;
    ptr = new int;
    *ptr = len;
}

Line::Line(const Line &obj)
{
    cout << "Copy constructor allocating ptr." << endl;
    ptr …
Run Code Online (Sandbox Code Playgroud)

c++ pass-by-reference copy-constructor

2
推荐指数
1
解决办法
155
查看次数