我想要字典#include <stdio.h>
#include <omp.h>
#define MAC1
#define MAC2
#ifdef MAC1
double x1 = 0.0, y1 = 0.1;
#endif
#ifdef MAC2
double x2 = 1.0, y2 = 1.1;
#endif
#if defined(MAC1) && defined(MAC2)
# define MY_OMP_LOOP_PRAGMA _Pragma("omp parallel for firstprivate(x1, y1, x2, y2)")
#elif defined(MAC1)
# define MY_OMP_LOOP_PRAGMA _Pragma("omp parallel for firstprivate(x1, y1)")
#elif defined(MAC2)
# define MY_OMP_LOOP_PRAGMA _Pragma("omp parallel for firstprivate(x2, y2)")
#endif
int main(int argc, char* argv[])
{
int imax = 10;
MY_OMP_LOOP_PRAGMA
for (int i=0; i < imax; ++i) {
#ifdef MAC1
printf("%d: %f, %f\n", omp_get_thread_num(), x1, y1);
#endif
#ifdef MAC2
printf("%d: %f, %f\n", omp_get_thread_num(), x2, y2);
#endif
}
return 0;
}
或哈希集SELECT TOP (100) PERCENT
RTRIM(OP.Standard_Op) AS TaskDescription,
OP.Op_Number AS OpStep,
CAST(CAST(OP.Works_Order_Number AS DECIMAL(12, 2)) AS NVARCHAR(50)) AS OrderCode,
CASE OP.Status
WHEN 'C' THEN 99
WHEN 'I' THEN 50
ELSE 0
END AS Status,
CAST(OP.Op_Number AS varchar(50)) AS OpCode,
CAST(CAST(OP.Works_Order_Number AS decimal(12, 2)) AS nvarchar(50)) + '_' + CAST(OP.Op_Number AS nvarchar(50)) AS JobCode,
TC.ClockingStatus
FROM
dbo.PROGRESS AS OP
INNER JOIN
dbo.vOrcData_ActiveOperations AS AW ON AW.Works_Order = OP.Works_Order_Number
AND AW.Op_Number = OP.Op_Number
INNER JOIN
dbo.WOHEAD AS WH ON WH.Works_Order = OP.Works_Order_Number
INNER JOIN
dbo.RESOURCE AS RR ON RR.Resource_Code = OP.Original_Resource_Code
LEFT OUTER JOIN
dbo.Techman_WOCLOCK AS TC ON OP.Works_Order_Number = TC.OrderCode
AND OP.Op_Number = TC.OpStep
LEFT OUTER JOIN
dbo.MEMO_FIELDS_SQL ON dbo.MEMO_FIELDS_SQL.Memo_Unique = OP.Man_Memo_Unique
LEFT OUTER JOIN
(SELECT
Allocated_WO_Num, Sub_Con_Op_No,
MAX(Date_Promised) AS Date_Promised
FROM
dbo.PODETAIL AS PODETAIL_1
GROUP BY
Allocated_WO_Num, Sub_Con_Op_No) AS PODETAIL ON PODETAIL.Allocated_WO_Num = OP.Works_Order_Number
AND PODETAIL.Sub_Con_Op_No = OP.Op_Number
LEFT OUTER JOIN
(SELECT
Works_Order, Operation,
SUM(Operation_Time) AS TimeComplete
FROM
dbo.WOCLOCK
GROUP BY
Works_Order, Operation) AS CLOCKEDTIME ON WH.Works_Order = CLOCKEDTIME.Works_Order AND OP.Op_Number = CLOCKEDTIME.Operation
。在我的应用程序中,它认为MyType类型的任何两个不同实例永远不会相等。在这种情况下使用GetHashCode和Equals的默认实现是否安全?
我不确定如何实现GetHashCode。但我总是想象它就像对象的内存位置。这是真的吗?
如果是这样,那么我想知道当垃圾收集器重定位对象时会发生什么?这会发生吗?这是否会导致MyType的对象再也无法在字典中找到?