标签: inline

OCaml 中@inlined 和@@inline 有什么区别?

在函数声明后使用@inlined 和使用@@inline 有什么区别?

ocaml inline

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

有没有办法确定一个方法是否将在C#中内联

假设你覆盖operator*for point3和for float然后for float,point3你使用了这样的运算符:

point3 * float
Run Code Online (Sandbox Code Playgroud)

你能知道运算符方法是否最终会被内联?

.net c# inline

0
推荐指数
1
解决办法
840
查看次数

内联模板化函数

我正在尝试为项目编写一些数学代码,我偶然发现了一个有趣的问题:

template<class T> class Radian;
template<class T> class Degree;

template <class T>
class Radian
{
public:
    T mRad;
public:
    Radian(const Degree& d);
};

template <class T>
class Degree
{
public:
    T mDeg;
public:
    Degree(const Radian& d);
};

inline Radian::Radian ( const Degree& d ) 
{

}

inline Degree::Radian ( const Radian& d )
{

}
Run Code Online (Sandbox Code Playgroud)

请注意,代码更大,但我删除了不必要的功能,以便您更好地理解它.

我理解模板是如何工作的,我知道它们是在编译时生成的,但对于这个特定的例子,我并不真正理解我应该使用什么语法.我知道在构造函数中,Degree应该有一个模板参数,但我不确定如何编写它.从我看到我可能不得不使用另一个模板,但两者使用相同的T会很好,因为我不会从Degree_float转换为Radian_double.

谁能对此有所了解?

谢谢.

c++ templates inline

0
推荐指数
1
解决办法
222
查看次数

AggressiveInlining何时适用于简单的包装器

当我简单地包装一个DataStructure调用时,我无法看到AggressiveInlining的影响

例如:

public class WList
{
   //made static just to check inlining
   //otherwise inlining might not kick in since 'this' keyword will disallow it
   static System.Collections.ArrayList list;

   [MethodImpl(MethodImplOptions.AggressiveInlining)]
   public override void Put(object item)
   {
       WList.list.Add(item);
   }
}
Run Code Online (Sandbox Code Playgroud)

然后这样做

    //Add 1000000 number of items in the list
    //Run this test many times 
    for (int j = 0; j < 100; j++)
    {
        Stopwatch sw = new Stopwatch();
        sw.Start();

        for (int i = 0; i < length; i++)
        {
            //ADD ITEMS IN …
Run Code Online (Sandbox Code Playgroud)

.net c# inline

0
推荐指数
1
解决办法
685
查看次数

内联功能或多或少安全

"内联"比使用"max"的预编译器定义更安全或更不安全(见下文)?

#define max(a,b)    (a > b) ? a : b
Run Code Online (Sandbox Code Playgroud)

鉴于此函数定义:

inline int max (int a, int b)
{
  return (a > b) ? a : b;
}
Run Code Online (Sandbox Code Playgroud)

c++ inline function

0
推荐指数
1
解决办法
135
查看次数

2文本框未显示在行中

我试图用一个标签在一行中显示2个文本框.

我已经使用了css,但它没有用.

jsfidle演示

<div class="inq_form_label_prd">
Subject :
</div>
<div class="inq_form_content_prd">
    <input type="text" class="inq_txtbox_prd" name="inq_sub_msg">
</div>
<div class="inq_form_label_prd1">
    Subject :
</div>
<div class="inq_form_content_prd1">
    <input type="text" class="inq_txtbox_prd" name="inq_sub_msg">
</div>
Run Code Online (Sandbox Code Playgroud)

CSS:

  .inq_form_label_prd
    {
        line-height: 28px;
        float: left;
        width: 120px;
        font-weight: bolder;
        text-align: right;
        padding-right: 10px;
        color: #666;
        margin-top:5px;
        margin-left:0px;
    }
    .inq_form_content_prd
    {
        margin-left: 130px;
        line-height: 28px;
        font-size:12px;
        font-weight:bolder;
    }
    .inq_form_label_prd1
    {
        line-height: 28px;
        float: left;
        width: 120px;
        font-weight: bolder;
        text-align: right;
        padding-right: 10px;
        color: #666;
        margin-top:5px;
        margin-left:200px;
    }
    .inq_form_content_prd1
    {
        margin-left: 390px;
        line-height: …
Run Code Online (Sandbox Code Playgroud)

html css inline

0
推荐指数
1
解决办法
5964
查看次数

C ++内联函数,参数按值传递

很好,我上次检查内联函数是一个函数,该函数的主体在调用该函数的程序的每个点中都直接替换。所以当我这样做时:

#include <iostream>
inline void increment(int n) { n = n + 1; }`
int main() { 
   int n = 0;
   increment(n);
   std::cout << "Result " << n;
}
Run Code Online (Sandbox Code Playgroud)

我应该有:结果1。相反,我得到0。

那么内联函数如何工作?

c++ inline pass-by-value

0
推荐指数
2
解决办法
1379
查看次数

Navbar未显示内联

我的Navbar没有显示内联.当变化的代码:.nav li a {...}向.nav li{...}它是线,但所有的CSS功能从HTML中的类= NAV消失.我试图添加,ul.nav{display: inline-block;}但它什么也没做.

我希望我解释得很好,我试图从昨天起就弄清楚...

html, body {
margin: 0;
  padding: 0;
}

.container {
  max-width: 940px;
  margin: 0 auto;
  padding: 5px;
}

.header {
  background-color: #333;
}

.nav {
  list-style-type: none;
  margin: 0;
  padding: 20px 0;
  letter-spacing: 1.6px;
}

.nav li a {
  display: inline;
  text-decoration: none;
  transition: 0.4s;
  color: #fff;
  font-family: 'Raleway', sans-serif;
  font-weight: 600;
  font-size: 12px;
  margin-right: 25px;
  text-transform: uppercase;
}

.nav li a:hover {
  background-color: #ffffff;
  color: …
Run Code Online (Sandbox Code Playgroud)

html css inline navbar

0
推荐指数
1
解决办法
1438
查看次数

如果我在C++中使用内联函数,为什么要重新定义'template <class T>?

我有2个头文件相同的头文件:

template<typename T> inline void func(){

}
Run Code Online (Sandbox Code Playgroud)

我在main.cpp文件中包含这两个头文件然后编译:

g++ main.cpp -o run
Run Code Online (Sandbox Code Playgroud)

但我得到:

In file included from main.cpp:2:0:
test2.cpp:1:34: error: redefinition of ‘template<class T> void func()’
 template<typename T> inline void func(){
                                  ^
In file included from main.cpp:1:0:
test.cpp:1:34: error: ‘template<class T> void func()’ previously declared here
 template<typename T> inline void func(){
Run Code Online (Sandbox Code Playgroud)

如果使用可以重新定义的内联函数,我会得到什么错误?

c++ templates inline

0
推荐指数
1
解决办法
671
查看次数

连续3张图像居中

我正在尝试使三个图像连续居中,然后在页面上居中。我已经将它们排成一排,但我无法使它们居中。关于让我的团队走到中间的任何建议?我在包含类和社交类上尝试了0自动。很近!!

我的HTML:首先是div class = contain来包装整个内容,但是由于某种原因,如果我尝试在HTML中包含类contains,它会在Stack Overflow上消失,所以请原谅。

.contain {
  max-width: 960px;
  text-align: center;
}

.social {
  position: relative;
  display: inline-block;
  float: left;
  padding: 10px;
}
Run Code Online (Sandbox Code Playgroud)
<div class="contain">
  <div align="center;" class="social">
    <img src="http://theinvicto.com/wp-
content/uploads/2017/12/facebook.png" alt="" width="75" height="75" />
  </div>
  <div align="center;" class="social">
    <img src="http://theinvicto.com/wp-content/uploads/2017/12/twitter.png" alt="" width="75" height="75" />
  </div>
  <div align="center;" class="social">
    <img src="http://theinvicto.com/wp-
content/uploads/2017/12/instagram.png" alt="" width="75" height="75" />
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

html css inline image

0
推荐指数
1
解决办法
762
查看次数

标签 统计

inline ×10

c++ ×4

css ×3

html ×3

.net ×2

c# ×2

templates ×2

function ×1

image ×1

navbar ×1

ocaml ×1

pass-by-value ×1