我想在CSS中创建这个设计.可能吗?

这是我的代码:
.triangle{
border-radius: 50%;
width: 120px;
height: 120px;
}
.triangle img {
width: 120px;
height: 120px;
}
.triangle::after{
right: 150px;
top: 50%;
border: solid transparent;
content:"";
height: 0px;
width: 0px;
position: absolute;
pointer-events: none;
border-color: white;
border-left-color: white;/*white is the color of the body*/
border-width: 60px;
margin-top: -60px
}Run Code Online (Sandbox Code Playgroud)
<div class="triangle">
<img src="http://deskode.com/images/placeholder/team/07.jpg">
</div>Run Code Online (Sandbox Code Playgroud)
形成三角形,但不是与图像相同.
我为什么这样做:
constexpr auto i_can() {
int a = 8;
a = 9;
//...
}
Run Code Online (Sandbox Code Playgroud)
但我不能这样做:
constexpr auto i_cannot() {
std::array<int, 10> arr{};
//I cannot
arr[5] = 9;
}
Run Code Online (Sandbox Code Playgroud)
我的问题是:
int,为什么我不能改变int数组内部的那个?reference std::array<T, N>::operator[](size_t)目前不是constexpr.我正在尝试按降序排序列表(类的一部分)包含a的项目struct,但它不编译:
错误:'__last - __first'中'operator-'不匹配
sort(Result.poly.begin(), Result.poly.end(), SortDescending());
Run Code Online (Sandbox Code Playgroud)
这是SortDescending:
struct SortDescending
{
bool operator()(const term& t1, const term& t2)
{
return t2.pow < t1.pow;
}
};
Run Code Online (Sandbox Code Playgroud)
谁能告诉我什么是错的?
std::array<std::pair<int, int>, 2> ids = { { 0, 1 }, { 1, 2 } };
Run Code Online (Sandbox Code Playgroud)
VS2013错误:
错误C2440:'初始化':无法从'int'转换为'std :: pair'没有构造函数可以采用源类型,或构造函数重载解析是不明确的
我究竟做错了什么?
我在技术访谈中被问到这个问题:
constC++中的a 和宏有什么区别?
我的回答是宏是一个预处理器指令,如果使用宏,可能很难调试应用程序,因为它在编译之前被常量表达式替换,而a const可以有类型标识符并且易于调试.
任何人都可以指出任何其他差异,哪些应该是首选?
编辑:
来自IBM C++文档:
以下是一些区别
#define和const类型修饰符:
该
#define指令可用于为数字,字符或字符串常量创建名称,而可声明任何类型的const对象.const对象受变量的作用域规则约束,而使用的常量不受约束
#define.与const对象不同,宏的值不会出现在编译器使用的中间源代码中,因为它们是内联扩展的.内联扩展使得调试器无法使用宏值.宏可以用在常量表达式中,例如数组绑定,而
const对象则不能.(我认为我们肯定需要使用宏来定义array_size.编译器不会对宏进行类型检查,包括宏参数.
我在工作中的一些源代码和其他一些代码中看到了一些名为'dirty'的变量.这是什么意思?什么是脏旗?
考虑以下代码来添加a的所有元素vector:
#include<iostream>
#include<algorithm>
#include<numeric>
#include<vector>
using namespace std;
int main(void)
{
std::vector<double> V;
V.push_back(1.2);
V.push_back(3.6);
V.push_back(5.6);
double sum = accumulate(V.begin(),V.end(),0);
cout << "The sum of the elements of the vector V is " << sum << endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
当我在Windows上的Cygwin上编译它并运行它时,我得到终端的输出为
矢量V的元素之和为9
该accumulate功能似乎是将所有数字四舍五入并加起来,这可以解释答案.
这是什么问题Cygwin的G ++编译器,或我的误解accumulate添加了功能vector的doubleS'
我试图找出打开文件之间的区别,如:
fstream *fileName*("FILE.dat",ios::binary);
Run Code Online (Sandbox Code Playgroud)
要么
fstream *fileName*("FILE.dat",ios::out);
Run Code Online (Sandbox Code Playgroud)
要么
fstream *fileName*("FILE.dat",ios::binary | ios::out);
Run Code Online (Sandbox Code Playgroud)
我发现,所有这些形式是相同的:在所有情况下,即使用产生该文件上的相同的输出*fileName*<<或*fileName*.write().
我有样品"Hello,World!" 来自网络的代码,我想在我大学的服务器上的GPU上运行它.当我输入"gcc main.c"时,它会响应:
CL/cl.h:没有这样的文件或目录
我该怎么办?我怎么能有这个头文件?
问题是关于在C++中为double数据类型建模无穷大.我需要在头文件中,所以我们不能使用像numeric_limits.
是否有定义的常量代表最大值?