草庐IT

libXXX_construct

全部标签

php - 可捕获的 fatal error :传递给 UsernamePasswordToken::__construct() 的参数 4 必须是数组,给定为空

登录我的Symfony应用程序时出现以下错误(使用正确的用户名和密码):ContextErrorException:CatchableFatalError:Argument4passedtoSymfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken::__construct()mustbeanarray,nullgiven,calledinD:\xampp\htdocs\essweb\vendor\symfony\symfony\src\Symfony\Component\Security\Cor

php - fatal error :未捕获异常 'Exception',消息为“DateTime::__construct(): 无法解析时间字符串

我收到这个错误(!)Fatalerror:Uncaughtexception'Exception'withmessage'DateTime::__construct():Failedtoparsetimestring(06-28-201407:43:58)atposition0(0):Unexpectedcharacter'in/Users/matt/Desktop/Likes/forgot/activate.phponline17尝试这样做时//DBquery$stmt=$con->prepare("SELECTtoken_created_atfromresetWHEREtoken=

c++ - allocator.construct 循环是否等于 std::uninitialized_copy?

在此背景下T是某种类型并且allocator是该类型的分配器对象。默认情况下为std::allocator但这不一定是真的。我有一大块内存被allocator.allocate(n)获取了.我还有一个容器con的T对象(比如std::vector)。我想用T初始化那block内存对象。内存块的位置存储在T*data中。.这两个代码示例是否始终相同?#include//example1std::uninitialized_copy(con.begin(),con.end(),data)//example2std::vector::const_iteratorin=con.begin();

c++ - 返回 C++17 可变参数模板的可变参数聚合(结构)和语法 'construction deduction guide'

使用模板结构,例如下面的many,可以返回一组固定的可能不可移动的对象,并使用c++17结构化绑定(bind)(auto[a,b,c]=f();声明变量a、b和c并从分配它们的值f返回例如结构或元组)。templatestructmany{T1a;T2b;T3c;};//guide:templatemany(T1,T2,T3)->many;autof(){returnmany{string(),5.7,unmovable()};};intmain(){auto[x,y,z]=f();}如这两个问题和答案中所述(Dostd::tupleandstd::pairsupportaggrega

c++ - std::piecewise_construct 语法如何工作?

当与std::map一起使用时,我对std::piecewise_construct有点困惑。示例:std::mapm;//usespair'spiecewiseconstructorm.emplace(std::piecewise_construct,std::forward_as_tuple("c"),std::forward_as_tuple(10,'c'));我不确定emplace()如何知道在使用piecewise_construct时如何以不同方式处理这种类型的构造。不应该是:std::piecewise_construct(std::forward_as_tuple("c

c++ - std::is_default_constructible<T> 错误,如果构造函数是私有(private)的

我有以下片段#include#includeclassC{C(){}};intmain(){static_assert(!boost::has_trivial_default_constructor::value,"Constructible");static_assert(!std::is_default_constructible::value,"Constructible");}条件不相等,但第一个条件工作正常,第二个构造给出错误,构造函数是私有(private)的。编译器gcc4.7...那么,这是gcc错误,还是由标准定义的?http://liveworkspace.org/

c++ - 为什么 std::allocator::construct 和 std::allocator::destroy 在元素类型上模板化?

std::allocator的construct和destroy成员函数根据要构造的元素的类型进行参数化:templateclassallocator{public:typedefTvalue_type;typedefT*pointer;templatevoidconstruct(U*p,Args&&...args);templatevoiddestroy(U*p);...};这样做的理由是什么?他们为什么不选择value_type*或pointer?好像allocator应该只知道如何构造或销毁T类型的对象. 最佳答案 这与all

c++ - std::is_constructible<void()>::value 的正确结果是什么?

std::is_constructible::value的结果不一致.我对该标准的解释是它应该是错误的。然而,Clang,同时具有libc++和libstdc++*,给出了true。GCC和MSVC都给出false。哪个结果是正确的?标准语这是标准的N4527[meta.unary.prop]/7:Giventhefollowingfunctiondeclaration:templateadd_rvalue_reference_tcreate()noexcept;thepredicateconditionforatemplatespecializationis_constructibl

c++ - 如何根据 is_nothrow_move_constructible<T> 声明包装类型 X<T> noexcept 的移动构造函数?

假设我有一个包装类型templatestructX{/*..*/};而且我不能只是X(X&&)=default因为我必须在那里做一些重要的事情。但是,我希望它是noexcept但前提是T(T&&)是noexcept。这可以使用::std::is_nothrow_move_constructible进行测试。我不知道如何根据constexpr有条件地启用构造函数的一个版本或另一个版本。我想可能有一种使用SFINAE的方法,但我不知道如何将其应用于ctors。 最佳答案 noexcept说明符接受任何bool常量表达式,因此您可以直接检

c++ - Clang 问题 : implicit type conversion at construction time

概要我正在努力使C++11代码与Clang兼容,并遇到了GCC>=4.6接受代码而Clang>=3.1不接受的情况。Clang认为候选构造函数不可行。详情这里是一个精简的例子来说明这个问题:#includetemplatestructT;templatestructT{typedefTsuper;constexprT(){}templateT(Args&&...){}};templatestructT:T{typedefTsuper;Headhead;T(Headarg):super(),head(std::move(arg)){}};structvoid_type{constexpr