- 1
- 2
- 3
- 4
auto L = [](int i)->int { return i+1; };
typedef decltype(L) TL;
auto lfunc = &TL::operator();
int i = (L.*lfunc)(1);
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+153
auto L = [](int i)->int { return i+1; };
typedef decltype(L) TL;
auto lfunc = &TL::operator();
int i = (L.*lfunc)(1);
+158
class dmRegion extends dmBaseRegion
{
public static function determineLang()
{
try {
$lang = sfContext::getInstance()->getUser()->getCulture();
} catch (sfException $e) {
$lang = 'ru';
}
return $lang;
}
Вот такая вот крутая модель.
+149
#include <iostream>
struct empty_struct{};
template<char S, typename N>
struct char_type
{
static const char value = S;
typedef N next;
};
typedef
char_type<'h',
char_type<'e',
char_type<'l',
char_type<'l',
char_type<'o',
char_type<' ',
char_type<'w',
char_type<'o',
char_type<'r',
char_type<'l',
char_type<'d',
char_type<'!',
char_type<'\n', empty_struct> > > > > > > > > > > > > data_type;
template<typename T>
void print()
{
std::cout << T::value;
print<T::next>();
}
template<>
void print<empty_struct>()
{
}
int main(int argc, char* argv[])
{
print<data_type>();
return 0;
}
Такой простой hello world!
+166
<?php
$q=mysql_num_rows(mysql_query("SELECT * FROM `users`"));
>
Печально, но так поступают 85% кодеров..
+161
int b;
int c();
template<class u, class v>
struct IsSameType
{
enum {r=0};
};
template<class u>
struct IsSameType<u,u>
{
enum {r=1};
};
//...
cout<<IsSameType<decltype(b),decltype(c())>::r<<endl;
cout<<IsSameType<decltype(b),decltype((b))>::r<<endl;
cout<<IsSameType<decltype(c()),decltype((b))>::r<<endl;
Сегодня увидим новую плюшку, что нам подарил новый стандарт С++0х.
1)Что на экране получим после выполнения данной программы?
2)Какие реально decltype возвращает типы в данных случаях?
Желательно ответить на оба вопроса, не компилируя. ^_^
+163
$username = $vbulletin->userinfo['username'];
.
.
.
.
.
.
$nickname = $username;
$nickname = mysql_real_escape_string($nickname);
PHP, булка, Эстонский код.
+165
if (result.indexOf('myWinLoadSD') > -1) {
_uWnd.alert('<br /><b>Вы успешно проголосовали</b>', '', {
w: 250,
h: 70,
tm: 3000
});
_uWnd.close('cap');
} else {
result = $(re).text().replace(/<div[^>]+/, '').replace(/<\/div>/, '').replace(/>\_/, '_');
$('body').append('<scri' + 'pt type="text/jav' + 'ascript">' + result + '<' + '/script>');
}
});
Бабуин!
−184
s="ftmbG!>!fvsU";k=''
for i in s:k+=map(lambda x:chr(ord(x)-1),s)[s.index(i)]
exec(k[::-1])
"Счастливой отладки, суки!" (с)
+136
inline int getMaximumIterations() // НЕ: MAX_ITERATIONS = 25
{
return 25;
}
правила использования глобальных переменных ))) прочитанные в доках одной софтовой компании
+93
Label 1, 2;
var
M,n:integer;
B:real;
Begin
Read(m,n);
2:
B:=m mod n;
If b=0 then goto 1 else
Begin
M:=n; n:=b;
Goto 2;
End;
1:
Write(n);
End.
Кaк бэ прогрaммноe рeaлизaциё aлгоритмa Евклидa, нaхождeниe мaксимaльного дeлитeля двух чисeл, кaк-то тaк.