This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public class Program { | |
private static void Main(string[] args) { | |
int[] x = new int[10]; | |
if (x is uint[]) { | |
Console.WriteLine("x is uint"); | |
} | |
object y = x; | |
if (y is uint[]) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef char (&yes)[1]; | |
typedef char (&no)[2]; | |
template <typename B, typename D> | |
struct Host { | |
operator B*() const; | |
operator D*(); | |
}; | |
template <typename B, typename D> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Вырезка из набора простых boundary test cases парсера C++ комментариев | |
// 2003-2005 (ц) Руслан "aruslan" Абдикеев | |
// Константы | |
std::cout << "C1. This is /* not a comment */\n"; | |
std::cout << "C2. This is // not a comment\n"; | |
std::cout << "C3. This is \" /* not a comment as well*/ \"\n"; | |
std::cout << "C4. This is \" // not a comment as well \"\n"; | |
std::cout << "C5. Let's print some random numbers: " << '/*' << '*/' << '\n'; | |
std::cout << "C6. Let's print a random number: " << '//' << '\n'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
template <typename... T> | |
struct counter; | |
template <> | |
struct counter<> { | |
static constexpr size_t count() { | |
return 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stddef.h> | |
int main() { | |
int a = 0; | |
const size_t size = (size_t)((char*)(&a + 1) - (char*)(&a)); | |
printf("%x", size); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
struct A {}; | |
struct B : virtual A {}; | |
struct C {}; | |
struct D : A, C {}; | |
struct E; | |
int main() { | |
std::cout << sizeof(void (A::*)()) << std::endl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Задача такая: дано N чисел, N <= 100000, числа натуральные. Требуется: найти подмножество этих чисел, такое, что их сумма кратна N или сказать, что такого подмножества не существует. | |
Пример: 2 1 2 3. Ответ, например, [1,3] или [2,2] (c) mehas | |
*/ | |
#include <iostream> | |
#include <vector> | |
using namespace std; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- original code | |
// when declaring this as const, FPS drops from 30fps to 4fps on NV. wat? | |
int T[8] = int[8](0x15,0x38,0x32,0x2c,0x0d,0x13,0x07,0x2a); | |
int b0(int N, int B) { return (N>>B) & 1; } | |
int b(ivec3 p, int B) { | |
return T[b0(p.x,B)<<2 | b0(p.y,B)<<1 | b0(p.z,B)]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sealed class StepProfiler | |
{ | |
private readonly Stopwatch _sw = new Stopwatch(); | |
private long _totalTime; | |
private bool _started; | |
public void Start() | |
{ | |
Debug.Assert(!_started); | |
Debug.Print("[!] Profiling started"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CoffeeScript port by David Bushong <david@bushong.net> | |
# | |
# Copyright 2012 Google Inc. All Rights Reserved. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# |
OlderNewer