我尝试使用<html>
<head>
<style>
input[type='text'] {width:50px;}
textarea {width:500px;height:300px;}
</style>
</head>
<body>
<div>
<h2>Test</h2>
<p>The number of words is <span id="wordCount"></span></p>
<textarea id="toCount"></textarea>
</div>
<script>
document.getElementById('toCount').addEventListener('input', function () {
var text = this.value,
count = text.trim().replace(/\s+/g, ' ').split(' ').length;
document.getElementById('wordCount').textContent = count;
});
</script>
</body>
</html>
&amp;编辑某人intrusive_ptr。 clang 3.7
,它会生成errors below(GCC 5.2.1确定):
-std=c++1z
但是我在第134行添加In file included from test_intrusive_ptr.cpp:10:
./intrusive_ptr.hpp:539:53: error: '_Weak_observer' is a private member of
'std::_Intrusive_ptr_impl::_Deleteable<std::default_delete<foo> >'
using _Observer = typename intrusive_base<_T, _D>::_Weak_observer;
^
test_intrusive_ptr.cpp:27:21: note: in instantiation of template class 'std::intrusive_weak_ptr<foo>' requested here
template class std::intrusive_weak_ptr<foo>;
^
./intrusive_ptr.hpp:141:9: note: implicitly declared private here
class _Weak_observer : public _Ref_count_base {
^
./intrusive_ptr.hpp:556:24: error: '__create_observer' is a private member of
'std::_Intrusive_ptr_impl::_Deleteable<std::default_delete<foo> >'
__observer = __rhs->__create_observer();
^
test_intrusive_ptr.cpp:27:21: note: in instantiation of member function 'std::intrusive_weak_ptr<foo,
std::default_delete<foo> >::intrusive_weak_ptr' requested here
template class std::intrusive_weak_ptr<foo>;
^
./intrusive_ptr.hpp:174:20: note: implicitly declared private here
_Weak_observer * __create_observer() const volatile {
^
2 errors generated.
后代码编译得很好。这是Clang中的错误吗?