Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
QObjectList list = getList();
std::sort (list.begin(), list.end(),
[] (QObject *p1, QObject *p2)
{
return qobject_cast<QWidget*>(p1)->windowTitle() <
qobject_cast<QWidget*>(p2)->windowTitle();
});
$ clang --version
Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.3.0
Thread model: posix
// file main.cpp
#include <iostream>
int main()
{
std::cout << "Hello, clang!";
return 0;
}
$ clang-3.1 -c -Wall -pedantic -std=c++0x -stdlib=libc++ main.cpp
In file included from main.cpp:1:
In file included from /usr/include/c++/v1/iostream:38:
In file included from /usr/include/c++/v1/ios:216:
In file included from /usr/include/c++/v1/__locale:15:
/usr/include/c++/v1/string:1952:10: error: overload resolution selected implicitly-deleted copy assignment operator
__r_ = _STD::move(__str.__r_);
^
/usr/include/c++/v1/string:1942:9: note: in instantiation of member function 'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__move_assign' requested here
__move_assign(__str, true_type());
^
/usr/include/c++/v1/string:1961:5: note: in instantiation of member function 'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__move_assign' requested here
__move_assign(__str, integral_constant<bool,
^
(............blablablabla............)
/usr/include/c++/v1/memory:1941:5: note: copy assignment operator is implicitly deleted because '__compressed_pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__rep, std::__1::allocator<char> >'
has a user-declared move constructor
__compressed_pair(__compressed_pair&& __p)
^
1 error generated.
$ clang++-3.1 -c -std=c++0x -stdlib=libc++ -### main.cpp
clang version 3.1 (tags/RELEASE_31/final)
Target: x86_64-apple-darwin11.3.0
Thread model: posix
"/usr/local/clang-3.1/bin/clang" "-cc1" "-triple" "x86_64-apple-macosx10.7.0" "-emit-obj" "-mrelax-all" "-disable-free" "-disable-llvm-verifier" "-main-file-name" "main.cpp" "-pic-level" "2" "-mdisable-fp-elim" "-masm-verbose" "-munwind-tables" "-target-cpu" "core2" "-target-linker-version" "123.2.1" "-coverage-file" "main.o" "-resource-dir" "/usr/local/clang-3.1/bin/../lib/clang/3.1" "-fmodule-cache-path" "/var/folders/b5/4r3g3pvx4nb0kh7fvrmjcdww0000gn/T/clang-module-cache" "-stdlib=libc++" "-std=c++0x" "-fdeprecated-macro" "-fdebug-compilation-dir" "/Users/Valentine/Projects/testcpp11" "-ferror-limit" "19" "-fmessage-length" "238" "-stack-protector" "1" "-mstackrealign" "-fblocks" "-fobjc-runtime-has-arc" "-fobjc-runtime-has-weak" "-fobjc-dispatch-method=mixed" "-fobjc-default-synthesize-properties" "-fcxx-exceptions" "-fexceptions" "-fdiagnostics-show-option" "-fcolor-diagnostics" "-o" "main.o" "-x" "c++" "main.cpp"
std::reverse
падает:/usr/include/c++/v1/algorithm:2086:89: error: no type named 'iterator_category' in 'std::__1::iterator_traits<QList<QObject *>::iterator>'
_VSTD::__reverse(__first, __last, typename iterator_traits<_BidirectionalIterator>::iterator_category());
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
namespace std {
struct bidirectional_iterator_tag;
struct random_access_iterator_tag;
}
Бесплатный крутой Xcode + SDK (в отличие от винды)
Высокий уровень совместимости и переносимости бинарников и исходников
А все «подводные камни» начинаются когда используешь не родные фреймворки и инструменты.
Qt/Objective-C++11 или сборка Qt-проекта с помощью GCC-4.7 и Clang