RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-242240

wcobalt's questions

Martin Hope
wcobalt
Asked: 2020-10-31 02:34:34 +0000 UTC

迭代器、右值和左值

  • 0

出于某种原因,需要实现您自己的迭代器 ( Forward iterator) ,它说明如下:

输入可以作为右值取消引用

输出可以作为左值取消引用(仅适用于可变迭代器类型)

在同一个地方,据说它Forward Iterator应该包括 和 的Input iperator功能Output iterator。那么怎么Forward iterator会有两个实现operator*分别返回value_type和reference_type(rvalue和lvalue)呢?

现在的问题是:我是否正确理解我的问题的前一段是胡说八道,并且lvalue根据上下文rvalue定义的概念(UPD:变化),因此,实现Forward iterator将包括返回一个参考可以这样使用lvalue吗rvalue?

c++
  • 1 个回答
  • 10 Views
Martin Hope
wcobalt
Asked: 2020-06-08 17:43:55 +0000 UTC

什么决定了 DE 或 WM 窗口的外观?[关闭]

  • 1
关闭。这个问题需要澄清或补充细节。目前不接受回复。

想改进这个问题?通过编辑此帖子添加更多详细信息并澄清问题。

3年前关闭。

改进问题

什么决定了窗口管理器或桌面环境窗口的外观?按钮、开关、文本字段的外观如何?

linux
  • 1 个回答
  • 10 Views
Martin Hope
wcobalt
Asked: 2020-05-31 04:31:49 +0000 UTC

我可以在任何可以使用 xlib 的地方使用 xkb 吗?

  • 2

我可以xkb在任何安装了 XServer 的系统上使用 , 中的功能吗?xlib?

linux
  • 1 个回答
  • 10 Views
Martin Hope
wcobalt
Asked: 2020-05-22 14:22:57 +0000 UTC

在构造函数中创建一个临时对象

  • 0

如果有这样的代码:

class A {
private:
    B mB;
public:
    A(B b) {
        mb = b;
    }
}

根据这个来源:

而使用分配是两步过程,即定义对象然后分配它。定义对象调用默认构造函数,然后赋值调用赋值运算符。因此,昂贵的操作。

那些。某处有一个构造函数调用,但在哪里?

c++
  • 1 个回答
  • 10 Views
Martin Hope
wcobalt
Asked: 2020-03-30 03:26:43 +0000 UTC

std::map 和带有复制构造函数的类

  • 5

为什么这段代码,它试图推送一对 -int和一个带有复制构造函数的类,不起作用?

int main() {
    std::map<int, A> m;

    A a;

    m.insert(std::make_pair(0, a));

    return 0;
}

A类:

A::A() = default;

A::A(A &a) {
    //smth
}

错误文字:

/home/wcobalt/Files/InstalledPrograms/clion-2018.2.4/bin/cmake/linux/bin/cmake --build /home/wcobalt/Files/test/cmake-build-debug --target test -- -j 2
Scanning dependencies of target test
[ 66%] Building CXX object CMakeFiles/test.dir/A.cpp.o
[ 66%] Building CXX object CMakeFiles/test.dir/main.cpp.o
In file included from /usr/include/c++/7/bits/stl_algobase.h:64:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from /home/wcobalt/Files/test/main.cpp:1:
/usr/include/c++/7/bits/stl_pair.h: In instantiation of ‘struct std::pair<int, A>’:
/home/wcobalt/Files/test/main.cpp:11:33:   required from here
/usr/include/c++/7/bits/stl_pair.h:292:17: error: ‘constexpr std::pair<_T1, _T2>::pair(const std::pair<_T1, _T2>&) [with _T1 = int; _T2 = A]’ declared to take const reference, but implicit declaration would take non-const
       constexpr pair(const pair&) = default;
                 ^~~~
/usr/include/c++/7/bits/stl_pair.h: In instantiation of ‘struct std::pair<const int, A>’:
/usr/include/c++/7/type_traits:787:65:   required by substitution of ‘template<class _Tp, class> static std::true_type std::__do_is_destructible_impl::__test(int) [with _Tp = std::pair<const int, A>; <template-parameter-1-2> = <missing>]’
/usr/include/c++/7/type_traits:798:35:   required from ‘struct std::__is_destructible_impl<std::pair<const int, A> >’
/usr/include/c++/7/type_traits:809:12:   required from ‘struct std::__is_destructible_safe<std::pair<const int, A>, false, false>’
/usr/include/c++/7/type_traits:824:12:   required from ‘struct std::is_destructible<std::pair<const int, A> >’
/usr/include/c++/7/type_traits:143:12:   [ skipping 2 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/usr/include/c++/7/type_traits:1070:12:   required from ‘struct std::__is_direct_constructible_new<std::pair<const int, A>, std::pair<int, A>&&>’
/usr/include/c++/7/type_traits:1078:12:   required from ‘struct std::__is_direct_constructible<std::pair<const int, A>, std::pair<int, A>&&>’
/usr/include/c++/7/type_traits:1118:12:   required from ‘struct std::__is_constructible_impl<std::pair<const int, A>, std::pair<int, A>&&>’
/usr/include/c++/7/type_traits:1129:12:   required from ‘struct std::is_constructible<std::pair<const int, A>, std::pair<int, A>&&>’
/usr/include/c++/7/bits/stl_map.h:805:32:   required by substitution of ‘template<class _Pair, class> std::pair<std::_Rb_tree_iterator<std::pair<const int, A> >, bool> std::map<int, A>::insert<_Pair, <template-parameter-1-2> >(_Pair&&) [with _Pair = std::pair<int, A>; <template-parameter-1-2> = <missing>]’
/home/wcobalt/Files/test/main.cpp:11:34:   required from here
/usr/include/c++/7/bits/stl_pair.h:292:17: error: ‘constexpr std::pair<_T1, _T2>::pair(const std::pair<_T1, _T2>&) [with _T1 = const int; _T2 = A]’ declared to take const reference, but implicit declaration would take non-const
/home/wcobalt/Files/test/main.cpp: In function ‘int main()’:
/home/wcobalt/Files/test/main.cpp:11:34: error: no matching function for call to ‘std::map<int, A>::insert(std::pair<int, A>)’
     m.insert(std::make_pair(0, a));
                                  ^
In file included from /usr/include/c++/7/map:61:0,
                 from /home/wcobalt/Files/test/main.cpp:2:
/usr/include/c++/7/bits/stl_map.h:621:7: note: candidate: std::map<_Key, _Tp, _Compare, _Alloc>::insert_return_type std::map<_Key, _Tp, _Compare, _Alloc>::insert(std::map<_Key, _Tp, _Compare, _Alloc>::node_type&&) [with _Key = int; _Tp = A; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, A> >; std::map<_Key, _Tp, _Compare, _Alloc>::insert_return_type = std::_Node_insert_return<std::_Rb_tree_iterator<std::pair<const int, A> >, std::_Node_handle<int, std::pair<const int, A>, std::allocator<std::_Rb_tree_node<std::pair<const int, A> > > > >; std::map<_Key, _Tp, _Compare, _Alloc>::node_type = std::_Node_handle<int, std::pair<const int, A>, std::allocator<std::_Rb_tree_node<std::pair<const int, A> > > >]
       insert(node_type&& __nh)
       ^~~~~~
/usr/include/c++/7/bits/stl_map.h:621:7: note:   no known conversion for argument 1 from ‘std::pair<int, A>’ to ‘std::map<int, A>::node_type&& {aka std::_Node_handle<int, std::pair<const int, A>, std::allocator<std::_Rb_tree_node<std::pair<const int, A> > > >&&}’
/usr/include/c++/7/bits/stl_map.h:626:7: note: candidate: std::map<_Key, _Tp, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator, std::map<_Key, _Tp, _Compare, _Alloc>::node_type&&) [with _Key = int; _Tp = A; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, A> >; std::map<_Key, _Tp, _Compare, _Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const int, A> >; std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<const int, A> >; std::map<_Key, _Tp, _Compare, _Alloc>::node_type = std::_Node_handle<int, std::pair<const int, A>, std::allocator<std::_Rb_tree_node<std::pair<const int, A> > > >]
       insert(const_iterator __hint, node_type&& __nh)
       ^~~~~~
/usr/include/c++/7/bits/stl_map.h:626:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/7/bits/stl_map.h:795:7: note: candidate: std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<std::pair<const _Key, _Tp> >::other>::iterator, bool> std::map<_Key, _Tp, _Compare, _Alloc>::insert(const value_type&) [with _Key = int; _Tp = A; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, A> >; typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<std::pair<const _Key, _Tp> >::other>::iterator = std::_Rb_tree_iterator<std::pair<const int, A> >; std::map<_Key, _Tp, _Compare, _Alloc>::value_type = std::pair<const int, A>]
       insert(const value_type& __x)
       ^~~~~~
/usr/include/c++/7/bits/stl_map.h:795:7: note:   no known conversion for argument 1 from ‘std::pair<int, A>’ to ‘const value_type& {aka const std::pair<const int, A>&}’
/usr/include/c++/7/bits/stl_map.h:802:7: note: candidate: std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<std::pair<const _Key, _Tp> >::other>::iterator, bool> std::map<_Key, _Tp, _Compare, _Alloc>::insert(std::map<_Key, _Tp, _Compare, _Alloc>::value_type&&) [with _Key = int; _Tp = A; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, A> >; typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<std::pair<const _Key, _Tp> >::other>::iterator = std::_Rb_tree_iterator<std::pair<const int, A> >; std::map<_Key, _Tp, _Compare, _Alloc>::value_type = std::pair<const int, A>]
       insert(value_type&& __x)
       ^~~~~~
/usr/include/c++/7/bits/stl_map.h:802:7: note:   no known conversion for argument 1 from ‘std::pair<int, A>’ to ‘std::map<int, A>::value_type&& {aka std::pair<const int, A>&&}’
/usr/include/c++/7/bits/stl_map.h:809:2: note: candidate: template<class _Pair, class> std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<std::pair<const _Key, _Tp> >::other>::iterator, bool> std::map<_Key, _Tp, _Compare, _Alloc>::insert(_Pair&&) [with _Pair = _Pair; <template-parameter-2-2> = <template-parameter-1-2>; _Key = int; _Tp = A; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, A> >]
  insert(_Pair&& __x)
  ^~~~~~
/usr/include/c++/7/bits/stl_map.h:809:2: note:   substitution of deduced template arguments resulted in errors seen above
/usr/include/c++/7/bits/stl_map.h:823:7: note: candidate: void std::map<_Key, _Tp, _Compare, _Alloc>::insert(std::initializer_list<std::pair<const _Key, _Tp> >) [with _Key = int; _Tp = A; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, A> >]
       insert(std::initializer_list<value_type> __list)
       ^~~~~~
/usr/include/c++/7/bits/stl_map.h:823:7: note:   no known conversion for argument 1 from ‘std::pair<int, A>’ to ‘std::initializer_list<std::pair<const int, A> >’
/usr/include/c++/7/bits/stl_map.h:853:7: note: candidate: std::map<_Key, _Tp, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator, const value_type&) [with _Key = int; _Tp = A; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, A> >; std::map<_Key, _Tp, _Compare, _Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const int, A> >; std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<const int, A> >; std::map<_Key, _Tp, _Compare, _Alloc>::value_type = std::pair<const int, A>]
       insert(const_iterator __position, const value_type& __x)
       ^~~~~~
/usr/include/c++/7/bits/stl_map.h:853:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/7/bits/stl_map.h:863:7: note: candidate: std::map<_Key, _Tp, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator, std::map<_Key, _Tp, _Compare, _Alloc>::value_type&&) [with _Key = int; _Tp = A; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, A> >; std::map<_Key, _Tp, _Compare, _Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const int, A> >; std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<const int, A> >; std::map<_Key, _Tp, _Compare, _Alloc>::value_type = std::pair<const int, A>]
       insert(const_iterator __position, value_type&& __x)
       ^~~~~~
/usr/include/c++/7/bits/stl_map.h:863:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/7/bits/stl_map.h:870:2: note: candidate: template<class _Pair, class> std::map<_Key, _Tp, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator, _Pair&&) [with _Pair = _Pair; <template-parameter-2-2> = <template-parameter-1-2>; _Key = int; _Tp = A; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, A> >]
  insert(const_iterator __position, _Pair&& __x)
  ^~~~~~
/usr/include/c++/7/bits/stl_map.h:870:2: note:   template argument deduction/substitution failed:
/home/wcobalt/Files/test/main.cpp:11:34: note:   candidate expects 2 arguments, 1 provided
     m.insert(std::make_pair(0, a));
                                  ^
In file included from /usr/include/c++/7/map:61:0,
                 from /home/wcobalt/Files/test/main.cpp:2:
/usr/include/c++/7/bits/stl_map.h:886:2: note: candidate: template<class _InputIterator> void std::map<_Key, _Tp, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _InputIterator = _InputIterator; _Key = int; _Tp = A; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, A> >]
  insert(_InputIterator __first, _InputIterator __last)
  ^~~~~~
/usr/include/c++/7/bits/stl_map.h:886:2: note:   template argument deduction/substitution failed:
/home/wcobalt/Files/test/main.cpp:11:34: note:   candidate expects 2 arguments, 1 provided
     m.insert(std::make_pair(0, a));
                                  ^
CMakeFiles/test.dir/build.make:62: recipe for target 'CMakeFiles/test.dir/main.cpp.o' failed
make[3]: *** [CMakeFiles/test.dir/main.cpp.o] Error 1
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/test.dir/all' failed
make[2]: *** [CMakeFiles/test.dir/all] Error 2
CMakeFiles/Makefile2:84: recipe for target 'CMakeFiles/test.dir/rule' failed
make[1]: *** [CMakeFiles/test.dir/rule] Error 2
Makefile:118: recipe for target 'test' failed
make: *** [test] Error 2
c++
  • 1 个回答
  • 10 Views
Martin Hope
wcobalt
Asked: 2020-02-24 05:58:55 +0000 UTC

访问链接向量的元素

  • 1

假设我们有一个类A:

A.h

#include <vector>

#ifndef UN1_A_H
#define UN1_A_H

#include "B.h"

class A {
public:
    std::vector<B&> get();
};


#endif //UN1_A_H

A.cpp

#include "A.h"
#include "B.h"

std::vector<B &> A::get() {
    std::vector<B&> bs;

    bs.push_back(*(new B()));
    bs.push_back(*(new B()));

    return bs;
}

还有一类B是什么都没有。

为什么我不能编译以下代码?:

#include "A.h"
#include "B.h"

int main() {
    A& a = *(new A());
    B& b = a.get()[0];
}

结论:

/usr/include/c++/7/bits/alloc_traits.h: In instantiation of ‘struct std::allocator_traits<std::allocator<B&> >’:
/usr/include/c++/7/ext/alloc_traits.h:50:10:   required from ‘struct __gnu_cxx::__alloc_traits<std::allocator<B&> >’
/usr/include/c++/7/bits/stl_vector.h:77:21:   required from ‘struct std::_Vector_base<B&, std::allocator<B&> >’
/usr/include/c++/7/bits/stl_vector.h:216:11:   required from ‘class std::vector<B&>’
/home/wcobalt/Files/BoAaP/2/un1/A.cpp:8:25:   required from here
/usr/include/c++/7/bits/alloc_traits.h:392:27: error: forming pointer to reference type ‘B&’
       using pointer = _Tp*;
                           ^
/usr/include/c++/7/bits/alloc_traits.h:395:39: error: forming pointer to reference type ‘B&’
       using const_pointer = const _Tp*;
                                       ^
In file included from /usr/include/c++/7/bits/stl_construct.h:61:0,
                 from /usr/include/c++/7/vector:62,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.h:5,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.cpp:5:
/usr/include/c++/7/ext/alloc_traits.h: In instantiation of ‘struct __gnu_cxx::__alloc_traits<std::allocator<B&> >’:
/usr/include/c++/7/bits/stl_vector.h:77:21:   required from ‘struct std::_Vector_base<B&, std::allocator<B&> >’
/usr/include/c++/7/bits/stl_vector.h:216:11:   required from ‘class std::vector<B&>’
/home/wcobalt/Files/BoAaP/2/un1/A.cpp:8:25:   required from here
/usr/include/c++/7/ext/alloc_traits.h:66:23: error: no members matching ‘__gnu_cxx::__alloc_traits<std::allocator<B&> >::_Base_type {aka std::allocator_traits<std::allocator<B&> >}::allocate’ in ‘__gnu_cxx::__alloc_traits<std::allocator<B&> >::_Base_type {aka struct std::allocator_traits<std::allocator<B&> >}’
     using _Base_type::allocate;
                       ^~~~~~~~
/usr/include/c++/7/ext/alloc_traits.h:67:23: error: no members matching ‘__gnu_cxx::__alloc_traits<std::allocator<B&> >::_Base_type {aka std::allocator_traits<std::allocator<B&> >}::deallocate’ in ‘__gnu_cxx::__alloc_traits<std::allocator<B&> >::_Base_type {aka struct std::allocator_traits<std::allocator<B&> >}’
     using _Base_type::deallocate;
                       ^~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/c++allocator.h:33:0,
                 from /usr/include/c++/7/bits/allocator.h:46,
                 from /usr/include/c++/7/vector:61,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.h:5,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.cpp:5:
/usr/include/c++/7/ext/new_allocator.h: In instantiation of ‘class __gnu_cxx::new_allocator<B&>’:
/usr/include/c++/7/bits/allocator.h:108:11:   required from ‘class std::allocator<B&>’
/usr/include/c++/7/bits/stl_vector.h:81:14:   required from ‘struct std::_Vector_base<B&, std::allocator<B&> >::_Vector_impl’
/usr/include/c++/7/bits/stl_vector.h:166:20:   required from ‘struct std::_Vector_base<B&, std::allocator<B&> >’
/usr/include/c++/7/bits/stl_vector.h:216:11:   required from ‘class std::vector<B&>’
/home/wcobalt/Files/BoAaP/2/un1/A.cpp:8:25:   required from here
/usr/include/c++/7/ext/new_allocator.h:63:26: error: forming pointer to reference type ‘B&’
       typedef _Tp*       pointer;
                          ^~~~~~~
/usr/include/c++/7/ext/new_allocator.h:64:26: error: forming pointer to reference type ‘B&’
       typedef const _Tp* const_pointer;
                          ^~~~~~~~~~~~~
In file included from /usr/include/c++/7/vector:61:0,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.h:5,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.cpp:5:
/usr/include/c++/7/bits/allocator.h: In instantiation of ‘class std::allocator<B&>’:
/usr/include/c++/7/bits/stl_vector.h:81:14:   required from ‘struct std::_Vector_base<B&, std::allocator<B&> >::_Vector_impl’
/usr/include/c++/7/bits/stl_vector.h:166:20:   required from ‘struct std::_Vector_base<B&, std::allocator<B&> >’
/usr/include/c++/7/bits/stl_vector.h:216:11:   required from ‘class std::vector<B&>’
/home/wcobalt/Files/BoAaP/2/un1/A.cpp:8:25:   required from here
/usr/include/c++/7/bits/allocator.h:113:26: error: forming pointer to reference type ‘B&’
       typedef _Tp*       pointer;
                          ^~~~~~~
/usr/include/c++/7/bits/allocator.h:114:26: error: forming pointer to reference type ‘B&’
       typedef const _Tp* const_pointer;
                          ^~~~~~~~~~~~~
In file included from /usr/include/c++/7/vector:64:0,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.h:5,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.cpp:5:
/usr/include/c++/7/bits/stl_vector.h: In instantiation of ‘class std::vector<B&>’:
/home/wcobalt/Files/BoAaP/2/un1/A.cpp:8:25:   required from here
/usr/include/c++/7/bits/stl_vector.h:247:20: error: no members matching ‘std::vector<B&>::_Base {aka std::_Vector_base<B&, std::allocator<B&> >}::_M_allocate’ in ‘std::vector<B&>::_Base {aka struct std::_Vector_base<B&, std::allocator<B&> >}’
       using _Base::_M_allocate;
                    ^~~~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:248:20: error: no members matching ‘std::vector<B&>::_Base {aka std::_Vector_base<B&, std::allocator<B&> >}::_M_deallocate’ in ‘std::vector<B&>::_Base {aka struct std::_Vector_base<B&, std::allocator<B&> >}’
       using _Base::_M_deallocate;
                    ^~~~~~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:920:7: error: forming pointer to reference type ‘B&’
       data() _GLIBCXX_NOEXCEPT
       ^~~~
/usr/include/c++/7/bits/stl_vector.h:924:7: error: forming pointer to reference type ‘B&’
       data() const _GLIBCXX_NOEXCEPT
       ^~~~
/usr/include/c++/7/bits/stl_vector.h:953:7: error: ‘void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = B&; _Alloc = std::allocator<B&>; std::vector<_Tp, _Alloc>::value_type = B&]’ cannot be overloaded
       push_back(value_type&& __x)
       ^~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:939:7: error: with ‘void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = B&; _Alloc = std::allocator<B&>; std::vector<_Tp, _Alloc>::value_type = B&]’
       push_back(const value_type& __x)
       ^~~~~~~~~
In file included from /usr/include/c++/7/bits/stl_vector.h:63:0,
                 from /usr/include/c++/7/vector:64,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.h:5,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.cpp:5:
/usr/include/c++/7/initializer_list: In instantiation of ‘class std::initializer_list<B&>’:
/home/wcobalt/Files/BoAaP/2/un1/A.cpp:14:12:   required from here
/usr/include/c++/7/initializer_list:54:26: error: forming pointer to reference type ‘B&’
       typedef const _E*  iterator;
                          ^~~~~~~~
/usr/include/c++/7/initializer_list:55:26: error: forming pointer to reference type ‘B&’
       typedef const _E*  const_iterator;
                          ^~~~~~~~~~~~~~
In file included from /usr/include/c++/7/vector:64:0,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.h:5,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.cpp:5:
/usr/include/c++/7/bits/stl_vector.h: In instantiation of ‘std::vector<_Tp, _Alloc>::~vector() [with _Tp = B&; _Alloc = std::allocator<B&>]’:
/home/wcobalt/Files/BoAaP/2/un1/A.cpp:9:21:   required from here
/usr/include/c++/7/bits/stl_vector.h:434:37: error: ‘struct std::_Vector_base<B&, std::allocator<B&> >::_Vector_impl’ has no member named ‘_M_start’; did you mean ‘_M_swap_data’?
       { std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
                       ~~~~~~~~~~~~~~^~~~~~~~
                       _M_swap_data
/usr/include/c++/7/bits/stl_vector.h:434:61: error: ‘struct std::_Vector_base<B&, std::allocator<B&> >::_Vector_impl’ has no member named ‘_M_finish’
       { std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
                                               ~~~~~~~~~~~~~~^~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h: In instantiation of ‘void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = B&; _Alloc = std::allocator<B&>; std::vector<_Tp, _Alloc>::value_type = B&]’:
/home/wcobalt/Files/BoAaP/2/un1/A.cpp:11:28:   required from here
/usr/include/c++/7/bits/stl_vector.h:941:20: error: ‘struct std::_Vector_base<B&, std::allocator<B&> >::_Vector_impl’ has no member named ‘_M_finish’
  if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage)
      ~~~~~~~~~~~~~~^~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:941:47: error: ‘struct std::_Vector_base<B&, std::allocator<B&> >::_Vector_impl’ has no member named ‘_M_end_of_storage’
  if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage)
                                 ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:943:60: error: ‘struct std::_Vector_base<B&, std::allocator<B&> >::_Vector_impl’ has no member named ‘_M_finish’
      _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish,
                                              ~~~~~~~~~~~~~~^~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:945:22: error: ‘struct std::_Vector_base<B&, std::allocator<B&> >::_Vector_impl’ has no member named ‘_M_finish’
      ++this->_M_impl._M_finish;
        ~~~~~~~~~~~~~~^~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:948:25: error: no matching function for call to ‘end()’
    _M_realloc_insert(end(), __x);
                      ~~~^~
In file included from /usr/include/c++/7/bits/stl_vector.h:63:0,
                 from /usr/include/c++/7/vector:64,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.h:5,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.cpp:5:
/usr/include/c++/7/initializer_list:99:5: note: candidate: template<class _Tp> constexpr const _Tp* std::end(std::initializer_list<_Tp>)
     end(initializer_list<_Tp> __ils) noexcept
     ^~~
/usr/include/c++/7/initializer_list:99:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/vector:64:0,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.h:5,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.cpp:5:
/usr/include/c++/7/bits/stl_vector.h:948:25: note:   candidate expects 1 argument, 0 provided
    _M_realloc_insert(end(), __x);
                      ~~~^~
In file included from /usr/include/c++/7/vector:66:0,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.h:5,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.cpp:5:
/usr/include/c++/7/bits/range_access.h:68:5: note: candidate: template<class _Container> decltype (__cont.end()) std::end(_Container&)
     end(_Container& __cont) -> decltype(__cont.end())
     ^~~
/usr/include/c++/7/bits/range_access.h:68:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/vector:64:0,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.h:5,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.cpp:5:
/usr/include/c++/7/bits/stl_vector.h:948:25: note:   candidate expects 1 argument, 0 provided
    _M_realloc_insert(end(), __x);
                      ~~~^~
In file included from /usr/include/c++/7/vector:66:0,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.h:5,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.cpp:5:
/usr/include/c++/7/bits/range_access.h:78:5: note: candidate: template<class _Container> decltype (__cont.end()) std::end(const _Container&)
     end(const _Container& __cont) -> decltype(__cont.end())
     ^~~
/usr/include/c++/7/bits/range_access.h:78:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/vector:64:0,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.h:5,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.cpp:5:
/usr/include/c++/7/bits/stl_vector.h:948:25: note:   candidate expects 1 argument, 0 provided
    _M_realloc_insert(end(), __x);
                      ~~~^~
In file included from /usr/include/c++/7/vector:66:0,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.h:5,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.cpp:5:
/usr/include/c++/7/bits/range_access.h:97:5: note: candidate: template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])
     end(_Tp (&__arr)[_Nm])
     ^~~
/usr/include/c++/7/bits/range_access.h:97:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/vector:64:0,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.h:5,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.cpp:5:
/usr/include/c++/7/bits/stl_vector.h:948:25: note:   candidate expects 1 argument, 0 provided
    _M_realloc_insert(end(), __x);
                      ~~~^~
In file included from /usr/include/c++/7/vector:66:0,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.h:5,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.cpp:5:
/usr/include/c++/7/bits/range_access.h:106:31: note: candidate: template<class _Tp> _Tp* std::end(std::valarray<_Tp>&)
   template<typename _Tp> _Tp* end(valarray<_Tp>&);
                               ^~~
/usr/include/c++/7/bits/range_access.h:106:31: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/vector:64:0,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.h:5,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.cpp:5:
/usr/include/c++/7/bits/stl_vector.h:948:25: note:   candidate expects 1 argument, 0 provided
    _M_realloc_insert(end(), __x);
                      ~~~^~
In file included from /usr/include/c++/7/vector:66:0,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.h:5,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.cpp:5:
/usr/include/c++/7/bits/range_access.h:107:37: note: candidate: template<class _Tp> const _Tp* std::end(const std::valarray<_Tp>&)
   template<typename _Tp> const _Tp* end(const valarray<_Tp>&);
                                     ^~~
/usr/include/c++/7/bits/range_access.h:107:37: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/vector:64:0,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.h:5,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.cpp:5:
/usr/include/c++/7/bits/stl_vector.h:948:25: note:   candidate expects 1 argument, 0 provided
    _M_realloc_insert(end(), __x);
                      ~~~^~
/usr/include/c++/7/bits/stl_vector.h:948:21: error: ‘_M_realloc_insert’ was not declared in this scope
    _M_realloc_insert(end(), __x);
    ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h: In instantiation of ‘std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = B&; _Alloc = std::allocator<B&>]’:
/usr/include/c++/7/bits/stl_vector.h:263:15:   required from ‘std::vector<_Tp, _Alloc>::vector() [with _Tp = B&; _Alloc = std::allocator<B&>]’
/home/wcobalt/Files/BoAaP/2/un1/A.cpp:9:21:   required from here
/usr/include/c++/7/bits/stl_vector.h:162:37: error: ‘struct std::_Vector_base<B&, std::allocator<B&> >::_Vector_impl’ has no member named ‘_M_start’; did you mean ‘_M_swap_data’?
       { _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage
                       ~~~~~~~~~~~~~~^~~~~~~~
                       _M_swap_data
/usr/include/c++/7/bits/stl_vector.h:162:61: error: ‘struct std::_Vector_base<B&, std::allocator<B&> >::_Vector_impl’ has no member named ‘_M_end_of_storage’
       { _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage
                                               ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:163:25: error: ‘struct std::_Vector_base<B&, std::allocator<B&> >::_Vector_impl’ has no member named ‘_M_start’; did you mean ‘_M_swap_data’?
         - this->_M_impl._M_start); }
           ~~~~~~~~~~~~~~^~~~~~~~
           _M_swap_data
/usr/include/c++/7/bits/stl_vector.h:162:22: error: ‘_M_deallocate’ was not declared in this scope
       { _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage
         ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         - this->_M_impl._M_start); }
         ~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h: In instantiation of ‘std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_Vector_impl() [with _Tp = B&; _Alloc = std::allocator<B&>]’:
/usr/include/c++/7/bits/stl_vector.h:127:17:   required from ‘std::_Vector_base<_Tp, _Alloc>::_Vector_base() [with _Tp = B&; _Alloc = std::allocator<B&>]’
/usr/include/c++/7/bits/stl_vector.h:263:15:   required from ‘std::vector<_Tp, _Alloc>::vector() [with _Tp = B&; _Alloc = std::allocator<B&>]’
/home/wcobalt/Files/BoAaP/2/un1/A.cpp:9:21:   required from here
/usr/include/c++/7/bits/stl_vector.h:89:65: error: using invalid field ‘std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_M_start’
  : _Tp_alloc_type(), _M_start(), _M_finish(), _M_end_of_storage()
                                                                 ^
/usr/include/c++/7/bits/stl_vector.h:89:65: error: using invalid field ‘std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_M_finish’
/usr/include/c++/7/bits/stl_vector.h:89:65: error: using invalid field ‘std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_M_end_of_storage’
/usr/include/c++/7/bits/stl_vector.h: In instantiation of ‘std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_Vector_impl(std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type&&) [with _Tp = B&; _Alloc = std::allocator<B&>; std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type = std::allocator<B&>]’:
/usr/include/c++/7/bits/stl_vector.h:145:53:   required from ‘std::_Vector_base<_Tp, _Alloc>::_Vector_base(std::_Vector_base<_Tp, _Alloc>&&) [with _Tp = B&; _Alloc = std::allocator<B&>]’
/usr/include/c++/7/bits/stl_vector.h:345:29:   required from ‘std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = B&; _Alloc = std::allocator<B&>]’
/home/wcobalt/Files/BoAaP/2/un1/A.cpp:14:12:   required from here
/usr/include/c++/7/bits/stl_vector.h:99:47: error: using invalid field ‘std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_M_start’
    _M_start(), _M_finish(), _M_end_of_storage()
                                               ^
/usr/include/c++/7/bits/stl_vector.h:99:47: error: using invalid field ‘std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_M_finish’
/usr/include/c++/7/bits/stl_vector.h:99:47: error: using invalid field ‘std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_M_end_of_storage’
/usr/include/c++/7/bits/stl_vector.h: In instantiation of ‘void std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_M_swap_data(std::_Vector_base<_Tp, _Alloc>::_Vector_impl&) [with _Tp = B&; _Alloc = std::allocator<B&>]’:
/usr/include/c++/7/bits/stl_vector.h:146:9:   required from ‘std::_Vector_base<_Tp, _Alloc>::_Vector_base(std::_Vector_base<_Tp, _Alloc>&&) [with _Tp = B&; _Alloc = std::allocator<B&>]’
/usr/include/c++/7/bits/stl_vector.h:345:29:   required from ‘std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = B&; _Alloc = std::allocator<B&>]’
/home/wcobalt/Files/BoAaP/2/un1/A.cpp:14:12:   required from here
/usr/include/c++/7/bits/stl_vector.h:105:14: error: using invalid field ‘std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_M_start’
    std::swap(_M_start, __x._M_start);
              ^~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:105:28: error: ‘struct std::_Vector_base<B&, std::allocator<B&> >::_Vector_impl’ has no member named ‘_M_start’; did you mean ‘_M_swap_data’?
    std::swap(_M_start, __x._M_start);
                        ~~~~^~~~~~~~
                        _M_swap_data
/usr/include/c++/7/bits/stl_vector.h:106:14: error: using invalid field ‘std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_M_finish’
    std::swap(_M_finish, __x._M_finish);
              ^~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:106:29: error: ‘struct std::_Vector_base<B&, std::allocator<B&> >::_Vector_impl’ has no member named ‘_M_finish’
    std::swap(_M_finish, __x._M_finish);
                         ~~~~^~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:107:14: error: using invalid field ‘std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_M_end_of_storage’
    std::swap(_M_end_of_storage, __x._M_end_of_storage);
              ^~~~~~~~~~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:107:37: error: ‘struct std::_Vector_base<B&, std::allocator<B&> >::_Vector_impl’ has no member named ‘_M_end_of_storage’
    std::swap(_M_end_of_storage, __x._M_end_of_storage);
                                 ~~~~^~~~~~~~~~~~~~~~~
CMakeFiles/un1.dir/build.make:75: recipe for target 'CMakeFiles/un1.dir/A.cpp.o' failed
make[3]: *** [CMakeFiles/un1.dir/A.cpp.o] Error 1
make[3]: *** Waiting for unfinished jobs....
In file included from /usr/include/c++/7/ext/alloc_traits.h:36:0,
                 from /usr/include/c++/7/bits/basic_string.h:40,
                 from /usr/include/c++/7/string:52,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
                 from /usr/include/c++/7/bits/ios_base.h:41,
                 from /usr/include/c++/7/ios:42,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from /home/wcobalt/Files/BoAaP/2/un1/main.cpp:1:
/usr/include/c++/7/bits/alloc_traits.h: In instantiation of ‘struct std::allocator_traits<std::allocator<B&> >’:
/usr/include/c++/7/ext/alloc_traits.h:50:10:   required from ‘struct __gnu_cxx::__alloc_traits<std::allocator<B&> >’
/usr/include/c++/7/bits/stl_vector.h:77:21:   required from ‘struct std::_Vector_base<B&, std::allocator<B&> >’
/usr/include/c++/7/bits/stl_vector.h:216:11:   required from ‘class std::vector<B&>’
/home/wcobalt/Files/BoAaP/2/un1/main.cpp:7:18:   required from here
/usr/include/c++/7/bits/alloc_traits.h:392:27: error: forming pointer to reference type ‘B&’
       using pointer = _Tp*;
                           ^
/usr/include/c++/7/bits/alloc_traits.h:395:39: error: forming pointer to reference type ‘B&’
       using const_pointer = const _Tp*;
                                       ^
In file included from /usr/include/c++/7/bits/basic_string.h:40:0,
                 from /usr/include/c++/7/string:52,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
                 from /usr/include/c++/7/bits/ios_base.h:41,
                 from /usr/include/c++/7/ios:42,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from /home/wcobalt/Files/BoAaP/2/un1/main.cpp:1:
/usr/include/c++/7/ext/alloc_traits.h: In instantiation of ‘struct __gnu_cxx::__alloc_traits<std::allocator<B&> >’:
/usr/include/c++/7/bits/stl_vector.h:77:21:   required from ‘struct std::_Vector_base<B&, std::allocator<B&> >’
/usr/include/c++/7/bits/stl_vector.h:216:11:   required from ‘class std::vector<B&>’
/home/wcobalt/Files/BoAaP/2/un1/main.cpp:7:18:   required from here
/usr/include/c++/7/ext/alloc_traits.h:66:23: error: no members matching ‘__gnu_cxx::__alloc_traits<std::allocator<B&> >::_Base_type {aka std::allocator_traits<std::allocator<B&> >}::allocate’ in ‘__gnu_cxx::__alloc_traits<std::allocator<B&> >::_Base_type {aka struct std::allocator_traits<std::allocator<B&> >}’
     using _Base_type::allocate;
                       ^~~~~~~~
/usr/include/c++/7/ext/alloc_traits.h:67:23: error: no members matching ‘__gnu_cxx::__alloc_traits<std::allocator<B&> >::_Base_type {aka std::allocator_traits<std::allocator<B&> >}::deallocate’ in ‘__gnu_cxx::__alloc_traits<std::allocator<B&> >::_Base_type {aka struct std::allocator_traits<std::allocator<B&> >}’
     using _Base_type::deallocate;
                       ^~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/c++allocator.h:33:0,
                 from /usr/include/c++/7/bits/allocator.h:46,
                 from /usr/include/c++/7/string:41,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
                 from /usr/include/c++/7/bits/ios_base.h:41,
                 from /usr/include/c++/7/ios:42,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from /home/wcobalt/Files/BoAaP/2/un1/main.cpp:1:
/usr/include/c++/7/ext/new_allocator.h: In instantiation of ‘class __gnu_cxx::new_allocator<B&>’:
/usr/include/c++/7/bits/allocator.h:108:11:   required from ‘class std::allocator<B&>’
/usr/include/c++/7/bits/stl_vector.h:81:14:   required from ‘struct std::_Vector_base<B&, std::allocator<B&> >::_Vector_impl’
/usr/include/c++/7/bits/stl_vector.h:166:20:   required from ‘struct std::_Vector_base<B&, std::allocator<B&> >’
/usr/include/c++/7/bits/stl_vector.h:216:11:   required from ‘class std::vector<B&>’
/home/wcobalt/Files/BoAaP/2/un1/main.cpp:7:18:   required from here
/usr/include/c++/7/ext/new_allocator.h:63:26: error: forming pointer to reference type ‘B&’
       typedef _Tp*       pointer;
                          ^~~~~~~
/usr/include/c++/7/ext/new_allocator.h:64:26: error: forming pointer to reference type ‘B&’
       typedef const _Tp* const_pointer;
                          ^~~~~~~~~~~~~
In file included from /usr/include/c++/7/string:41:0,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
                 from /usr/include/c++/7/bits/ios_base.h:41,
                 from /usr/include/c++/7/ios:42,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from /home/wcobalt/Files/BoAaP/2/un1/main.cpp:1:
/usr/include/c++/7/bits/allocator.h: In instantiation of ‘class std::allocator<B&>’:
/usr/include/c++/7/bits/stl_vector.h:81:14:   required from ‘struct std::_Vector_base<B&, std::allocator<B&> >::_Vector_impl’
/usr/include/c++/7/bits/stl_vector.h:166:20:   required from ‘struct std::_Vector_base<B&, std::allocator<B&> >’
/usr/include/c++/7/bits/stl_vector.h:216:11:   required from ‘class std::vector<B&>’
/home/wcobalt/Files/BoAaP/2/un1/main.cpp:7:18:   required from here
/usr/include/c++/7/bits/allocator.h:113:26: error: forming pointer to reference type ‘B&’
       typedef _Tp*       pointer;
                          ^~~~~~~
/usr/include/c++/7/bits/allocator.h:114:26: error: forming pointer to reference type ‘B&’
       typedef const _Tp* const_pointer;
                          ^~~~~~~~~~~~~
In file included from /usr/include/c++/7/vector:64:0,
                 from /home/wcobalt/Files/BoAaP/2/un1/A.h:5,
                 from /home/wcobalt/Files/BoAaP/2/un1/main.cpp:2:
/usr/include/c++/7/bits/stl_vector.h: In instantiation of ‘class std::vector<B&>’:
/home/wcobalt/Files/BoAaP/2/un1/main.cpp:7:18:   required from here
/usr/include/c++/7/bits/stl_vector.h:247:20: error: no members matching ‘std::vector<B&>::_Base {aka std::_Vector_base<B&, std::allocator<B&> >}::_M_allocate’ in ‘std::vector<B&>::_Base {aka struct std::_Vector_base<B&, std::allocator<B&> >}’
       using _Base::_M_allocate;
                    ^~~~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:248:20: error: no members matching ‘std::vector<B&>::_Base {aka std::_Vector_base<B&, std::allocator<B&> >}::_M_deallocate’ in ‘std::vector<B&>::_Base {aka struct std::_Vector_base<B&, std::allocator<B&> >}’
       using _Base::_M_deallocate;
                   ^~~~~~~~~~~~~

...

c++
  • 1 个回答
  • 10 Views
Martin Hope
wcobalt
Asked: 2020-02-01 04:18:43 +0000 UTC

BEM 和块状态

  • 0

根据 BEM,如何实现具有两种状态的按钮:按下和未按下?使用伪类还是创建修饰符?但是毕竟如果你创建了修饰符,你将不得不通过 JavaScript 来管理状态,这有点惨。

javascript
  • 1 个回答
  • 10 Views
Martin Hope
wcobalt
Asked: 2020-01-19 19:30:01 +0000 UTC

对指向非常量的指针赋值,对常量的引用

  • -3

为什么可以做到以下几点?这里发生了什么?

const int& a = 10;
int* b;

*b = a;
c++
  • 2 个回答
  • 10 Views
Martin Hope
wcobalt
Asked: 2020-01-08 16:28:10 +0000 UTC

不可写但可变的对象实例

  • 1

需要创建一个对象的实例(例如string),以便它满足以下条件:

  1. 它不能被覆盖 - 即

    //声明和定义字符串a的一个实例(这个实例必须满足这些条件)

    //字符串b的其他实例的声明和定义

    a = b; //不可能的

  2. 实例可以通过其方法进行修改

问题:如何声明这样的实例?

PS我来自Java,这final ArrayList<Integer> a仅意味着不可能用a其他人覆盖ArrayList,但是,我们可以将元素添加到此列表中并删除它们。在 C++ 中,如果一个对象被标记为,const我们不能以任何方式改变它。

UPD

问题是这样的:我有一个类Scene(简化,可以这样表示):

class Scene {
private:
    std::vector<GameObject*> instances;
public:
    const GameObject& getInstance(unsigned int id);
    void destroyInstance(unsigned int id);
}

该类GameObject具有允许您更改其状态的方法。同时,它getInstance()应该返回一个指针/引用GameObject,而我不希望它可以覆盖GameObject返回的链接所定位的/指针,但是,同时,我希望能够调用方法改变GameObject它的状态。这只能通过禁止运营商来实现吗?

java
  • 3 个回答
  • 10 Views
Martin Hope
wcobalt
Asked: 2020-01-05 17:54:03 +0000 UTC

返回指针时违反封装

  • 0

假设我们有一个类A:

class A {
private:
    int* v;
public:
    A() {
        v = new int;
        *v = 7;
    }

    int* get() {
        return v;
    }
};

并且有代码main():

int main() {
    A* a = new A();

    std::cout << *(a->get()) << "\n";

    int* v1 = a->get();

    *v1 = 3;

    std::cout << *(a->get());

    return 0;
}

7执行后,将显示3。v因此,我通过这种方式更改了类的私有字段指向的值A,因此我破坏了封装。在这个例子中,使用指针是多余的,但是,如果我想在堆上存储任何对象,我将不得不使用指针。

问题:如何组织一个类A以便在堆上存储一个值,返回它(不是副本),同时不能改变这个值,而不是通过类方法A(通过方法A,值必须是可变的(常量将不行))?

c++
  • 2 个回答
  • 10 Views
Martin Hope
wcobalt
Asked: 2020-11-22 01:22:07 +0000 UTC

依赖注入、临时变量和原语

  • 1

假设在其中一个组件中,您需要以某种方式打开一个文件。例如,如果您BufferedReader在带有资源的 try/catch 块中执行此操作,那么结果是组件依赖于BufferedReader,但为什么不在构造函数中传递任何非原始类型的临时变量以避免依赖?“修复”它有多好?

PS我希望问题很清楚

java
  • 1 个回答
  • 10 Views
Martin Hope
wcobalt
Asked: 2020-10-21 16:39:38 +0000 UTC

为 git push/git pull 设置默认分支

  • 1

在学习git的时候,遇到了如下问题:

git pull1)我可以通过git branch --set-upstream-to remoteRep/remoteBranch在该分支上将分支设置为默认分支。

git pull2) 将其设为can的“非默认”分支git branch --unset-upstream。

git push3) 将其设为mogu 执行时的默认分支git push -u remoteRep remoteBranch

4)以及如何删除其tracked状态git push?


为什么--unset-upstream没有分支git push?

git init
git remote add tr https://github.com/wcobalt/testrepo.git
git pull tr master
git remote show tr
* внешний репозиторий tr
  URL для извлечения: https://github.com/wcobalt/testrepo.git
  URL для отправки: https://github.com/wcobalt/testrepo.git
  HEAD ветка: master
  Внешние ветки:
    b1     отслеживается
    master отслеживается
  Локальная ссылка, настроенная для «git push»:
    master будет отправлена в master (уже актуальна)
git branch --unset-upstream
fatal: Ветка «master» не имеет информации о вышестоящей ветке
git
  • 1 个回答
  • 10 Views
Martin Hope
wcobalt
Asked: 2020-10-14 18:24:24 +0000 UTC

git 差异选项

  • 1

了解选项git diff:

1)比较index和working area-git diff

2)比较HEAD和working area-git diff HEAD

3)比较index和HEAD-git diff --staged

这是真实的?

为什么在提交文件然后更改git diff --staged它之后它不显示任何内容 - 毕竟,索引是空的,但HEAD不是 - 即 有区别吗?

git
  • 1 个回答
  • 10 Views
Martin Hope
wcobalt
Asked: 2020-09-19 00:08:55 +0000 UTC

仅通过其方法访问类字段

  • 1

标题中描述的原则是最佳实践。但是问题来了:在类的方法中,除了get-methods之外set-,还应该通过get-методов还是直接访问字段?

ооп
  • 1 个回答
  • 10 Views
Martin Hope
wcobalt
Asked: 2020-09-17 13:55:17 +0000 UTC

带有 C/C++ 源代码的文件名

  • 3
  1. C/C++中的源文件名有什么限制吗?(例如在 Java 中,源文件的名称必须与其中的类名称匹配)

  2. .h/.hpp 和 .c/.cpp 文件应该同名吗?如果不是,当我编写#include 时,编译器如何知道头文件的实现在哪里?

c++
  • 1 个回答
  • 10 Views
Martin Hope
wcobalt
Asked: 2020-08-10 03:03:47 +0000 UTC

使用 Maven 创建 WAR

  • 0

我的任务是将应用程序构建到 WAR 存档中。我有以下内容pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.modularplatform</groupId>
    <artifactId>ModularPlatform</artifactId>
    <version>0.0.1</version>
    <packaging>war</packaging>

    <dependencies>
        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-servlet-api</artifactId>
            <version>9.0.10</version>
        </dependency>
    </dependencies>
    <build>
        <outputDirectory>build/</outputDirectory>
        <resources>
            <resource>
                <directory>src/main/resources/</directory>
                <includes>
                    <include>*</include>
                    <include>s/*</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/webapp/</directory>
                <includes>
                    <include>*</include>
                    <include>WEB-INF/*</include>
                </includes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.2.1</version>
                <configuration>
                    <attachClasses>true</attachClasses>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>war</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

编译后,build/目录下没有war包。我究竟做错了什么?

PS 我用 InteliJIdea

java
  • 1 个回答
  • 10 Views
Martin Hope
wcobalt
Asked: 2020-08-02 21:09:36 +0000 UTC

Apache2 和 Tomcat 9 集成

  • 0

安装了 Apache、Tomcat 和 mod_jk。Worker.properties 部分:

worker.ajp13_worker.port=8009
worker.ajp13_worker.host=localhost
worker.ajp13_worker.type=ajp13

Apache 监听 80 端口。 jk.conf 的一部分:

JkMount /tui/* ajp13_worker
JkMount /tui ajp13_worker

Tomcat 正在监听 8009。Server.xml 部分:

<Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

该应用程序位于/opt/tomcat/webapps/tui/. 它有 index.html 和一个 servlet。servlet 很好,可以通过localhost:8080/tui/servlet. index.html 也是通过localhost:8080/tui. 但是,这是对 Tomcat 的直接调用(不是吗?)。如果你尝试访问 80 端口,那么 Apache 指的是错误的地方。也就是说,可能 Apache 没有与 Tomcat 连接。我究竟做错了什么?

PS 我的任务是让 Apache 处理静态数据,让 tomcat 处理 servlet 和 JSP。

java
  • 1 个回答
  • 10 Views
Martin Hope
wcobalt
Asked: 2020-07-23 02:37:57 +0000 UTC

从实现接口的抽象类继承

  • 3

在设计游戏时,出现了一个问题。假设有一个接口IUnit,它由所有描述单元的类实现。但是对于这些类,一些代码可能是相同的,因此,您要么必须复制代码,这与函数的目的相矛盾,要么添加默认行为。

我决定这样做:接口仍然存在,但添加了一个抽象类,该类UnitBase实现了某些方法的默认行为,并且描述单元的类要么显式实现接口,如果它们根本不相似UnitBase,或者继承UnitBase以避免代码重复。

然而,有一种观点认为继承破坏了封装,因此抽象类的继承是不好的,我的方法也不好。这是真的吗?这种架构如何与 OOP 的规范相对应?

c++
  • 1 个回答
  • 10 Views
Martin Hope
wcobalt
Asked: 2020-07-15 20:56:26 +0000 UTC

为什么要识别单个音素?

  • 3

在学习语音识别时,我偶然发现了这篇文章。它识别音素,然后将它们组合成单词。

为什么要这样做,因为您可以将传入的流拆分为单词,然后为它们生成MFCC ,并通过神经网络将MFCC与字典进行比较?或者那不可能?

нейронные-сети
  • 1 个回答
  • 10 Views
Martin Hope
wcobalt
Asked: 2020-07-03 02:33:40 +0000 UTC

文档是为谁编写的?

  • -1

假设一个团队开发的不是一个可以获取和使用的程序,而是一个供其他程序员使用的库。那么:代码文档是为将要使用该库的人还是为开发它的团队编写的?

документация
  • 3 个回答
  • 10 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5