- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
template<class T>
void FuncSmth(T value)
{
if(typeid(T) == typeid(int))
FuncInt(value);
else if(typeid(T) == typeid(char*))
FuncCharPtr(value);
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+20
template<class T>
void FuncSmth(T value)
{
if(typeid(T) == typeid(int))
FuncInt(value);
else if(typeid(T) == typeid(char*))
FuncCharPtr(value);
}
Оттуда
+21
typedef void *(*internalPointer) (const std::map<std::string, std::pair<const void* volatile* const, void* const *> > (*FuncPointer)(volatile const int&, const char *const, const void *const *const (*FuncArg)(const std::vector<std::string>&)), void * const *, volatile int&, int * (*FuncArg2) (const std::string&, const std::vector<void>*) );
+12
if ( (_gen_statP==tm_Manual) ||
(_gen_statP==tm_OK) && (_cur_statP!=tm_Manual) ||
(_gen_statP==tm_ValidTM) && (_cur_statP!=tm_Manual) && (_cur_statP!=tm_OK) ||
(_gen_statP==tm_Rejected) && (_cur_statP!=tm_Manual) && (_cur_statP!=tm_OK) && (_cur_statP!=tm_ValidTM) ||
(_gen_statP==tm_Bad) && (_cur_statP!=tm_Manual) && (_cur_statP!=tm_OK) && (_cur_statP!=tm_ValidTM) && (_cur_statP!=tm_Rejected) ||
(_gen_statP==tm_Statistic) && (_cur_statP!=tm_Manual) && (_cur_statP!=tm_OK) && (_cur_statP!=tm_ValidTM) && (_cur_statP!=tm_Rejected) && (_cur_statP!=tm_Bad)
) {
_cur_statP = _gen_statP;
}
if ( (_gen_statQ==tm_Manual) ||
(_gen_statQ==tm_OK) && (_cur_statQ!=tm_Manual) ||
(_gen_statQ==tm_ValidTM) && (_cur_statQ!=tm_Manual) && (_cur_statQ!=tm_OK) ||
(_gen_statQ==tm_Rejected) && (_cur_statQ!=tm_Manual) && (_cur_statQ!=tm_OK) && (_cur_statQ!=tm_ValidTM) ||
(_gen_statQ==tm_Bad) && (_cur_statQ!=tm_Manual) && (_cur_statQ!=tm_OK) && (_cur_statQ!=tm_ValidTM) && (_cur_statQ!=tm_Rejected) ||
(_gen_statQ==tm_Statistic) && (_cur_statQ!=tm_Manual) && (_cur_statQ!=tm_OK) && (_cur_statQ!=tm_ValidTM) && (_cur_statQ!=tm_Rejected) && (_cur_statQ!=tm_Bad)
) {
_cur_statQ = _gen_statQ;
}
Вроде работает, но уж больно некрасиво) по идее вычисляет новый статус в соответствии с "приоритетом"
+144
;(function ($) {
// alias Math methods - used a lot!
var min = Math.min
, max = Math.max
, round = Math.floor
lol
−121
- (id) init {
if ((self = [super init]) == nil) return nil;
...
}
Как автор сюда еще тернарный оператор взгромоздить не додумался?
+125
<Target Name="AfterBuild">
<PropertyGroup>
<base>$(ProjectDir.Replace('\', '/'))</base>
</PropertyGroup>
<Exec Command="$(bash) -c 'cd $(base)doc ; thor md:generate $(base)doc/doc.md'" />
Генерация документации по феншую.
+155
/**
* Конструктор класса
* @param mixed $db
*/
public function __construct($db = null)
{
if ($db instanceof db) {
self::$_db = & $db;
} // передан объект БД
elseif ($db !== null) {
self::$_db = new db($db);
} // создание по схеме БД
else {
self::$_db = new db();
} // создание по умолчанию
return $this;
}
+136
int a;
cout<<"Enter a\n";
cin>>a;
if (a==1 && a!=2 && a!=3 && a!=4 && a!=5 && a<=5)
{
cout<<"Odin"<<endl;
}
else if (a==2 && a!=1 && a!=3 && a!=4 && a!=5 && a<=5)
{
cout<<"Dva"<<endl;
}
else if (a==3 && a!=1 && a!=2 && a!=4 && a!=5 && a<=5)
{
cout<<"Tri"<<endl;
}
else if (a==4 && a!=1 && a!=2 && a!=3 && a!=5 && a<=5)
{
cout<<"Chetire"<<endl;
}
else if (a==5 && a!=1 && a!=2 && a!=3 && a!=4 && a<=5)
{
cout<<"Pyat"<<endl;
}
как-то глянул в код соседа)
+149
<?php if ($tags) { ?>
<div class="tags"><b><?php echo $text_tags; ?></b>
<?php for ($i = 0; $i < count($tags); $i++) { ?>
<?php if ($i < (count($tags) - 1)) { ?>
<a href="<?php echo $tags[$i]['href']; ?>"><?php echo $tags[$i]['tag']; ?></a>,
<?php } else { ?>
<a href="<?php echo $tags[$i]['href']; ?>"><?php echo $tags[$i]['tag']; ?></a>
<?php } ?>
<?php } ?>
</div>
<?php } ?>
opencart 1.5.6
+105
class GeneticAlgorithm
{
...
private List<Individual> childs= new List<Individual>();
...
public List<int> Genetare(....)
{
......
childs.Clear();
Parallel.For(0, countOfCrossover,RandomCrossing);
_population.AddRange(childs);
.....
}
private void RandomCrossing(int stateInfo)
{
.............
var child = Сrossing(parents, counOfCrossoverPoints);
childs.AddRange(child);
}
Классический пример моей невнимательности.
Приделывал параллельность в генетический алгоритм