首页 \ 问答 \ 开始学习laravel框架[关闭](Start learning laravel framework [closed])

开始学习laravel框架[关闭](Start learning laravel framework [closed])

我想学习php框架,laravel。 我在计算机上安装了laravel 5.2,但我不知道如何开始探索它。 那么,有没有推荐的网站让我学习laravel框架?


I want to learn php framework, laravel. I have installed laravel 5.2 on my computer but I don't know how can I start to explore it. So, is there any recommended website for me to learn laravel framework?


原文:https://stackoverflow.com/questions/38139448
更新时间:2019-11-11 04:41

最满意答案

字符串的容量大小是否总是15的倍数?

没有; 关于std::string容量的唯一保证是s.capacity() >= s.size()

一个好的实现可能会使容量呈指数增长,这样每次需要重新分配底层数组时,它的容量就会扩大一倍。 这是std::vector所必需的,这样push_back可以具有分期恒定的时间复杂度,但是对于std::string没有这样的要求。

另外, std::string实现可以执行小型字符串优化,其中比std::string对象本身存储的字符数小于一定数量的字符,而不是存储在动态分配的数组中。 这很有用,因为很多字符串很短,动态分配可能很昂贵。 通常,如果存储字符串所需的字节数小于将指针存储到动态分配的缓冲区中所需的字节数,则会执行小型字符串优化。

我不知道你的特定实现是否执行小字符串优化。


Is the capacity size of string always a multiple value of 15?

No; the only guarantee about the capacity of a std::string is that s.capacity() >= s.size().

A good implementation will probably grow the capacity exponentially so that it doubles in size each time a reallocation of the underlying array is required. This is required for std::vector so that push_back can have amortized constant time complexity, but there is no such requirement for std::string.

In addition, a std::string implementation can perform small string optimizations where strings smaller than some number of characters are stored in the std::string object itself, not in a dynamically allocated array. This is useful because many strings are short and dynamic allocation can be expensive. Usually a small string optimization is performed if the number of bytes required to store the string is smaller than the number of bytes required to store the pointers into a dynamically allocated buffer.

Whether or not your particular implementation performs small string optimizations, I don't know.

相关问答

更多
  • 字符串的容量大小是否总是15的倍数? 没有; 关于std::string容量的唯一保证是s.capacity() >= s.size() 。 一个好的实现可能会使容量呈指数增长,这样每次需要重新分配底层数组时,它的容量就会扩大一倍。 这是std::vector所必需的,这样push_back可以具有分期恒定的时间复杂度,但是对于std::string没有这样的要求。 另外, std::string实现可以执行小型字符串优化,其中比std::string对象本身存储的字符数小于一定数量的字符,而不是存储在动态 ...
  • 当std::vector耗尽电力时,必须分配一个新的块。 你已经正确地说明了原因。 IMO 会增加分配器接口是有意义的。 我们中的两个人尝试使用C ++ 11,我们无法获得支持: [1] [2] 我相信为了做这个工作,需要一个额外的C级API。 我也没有得到这样的支持: [3] When std::vector runs out of capacity it has to allocate a new block. You have correctly covered the reasons. ...
  • 你不能。 您必须循环并手动呼叫reserve 。 (就此而言, segments还没有vector ......如何在不存在的矢量中预留空间?:)) You can't. You have to loop through and call reserve manually. (And for that matter there are no vectors inside segments yet.. how could reserve space in a nonexistent vector? :) )
  • 这是一个很好的问题。 我将冒着火焰战争的风险,说用户代码中的capacity()调用是代码气味。 调用它的唯一原因是在操作中避免内存分配。 在这种情况下,更清晰且更容错的策略是创建一个自己的类(比如limited_length_string )。 可能的实现可能预先分配足够的内存(通过它自己的实现或通过封装std::string并在其上调用reserve() 。 如果您在代码中看到此调用,那么请注意地雷。 如果你写这个电话,那就是你的设计是可疑的信号。 It's a good question. I'm g ...
  • 如何将std :: vector的容量限制为元素的数量 您可以做的最好的事情是在添加元素之前保留所需的空间。 这也应该具有最佳性能,因为它没有重新分配和复制。 如果这不实用,那么你可以在添加元素后使用std::vector::shrink_to_fit() 。 当然,如果分配可能永远不会高于设定限制,那么这无济于事。 从技术上讲,标准不能保证这些方法都不符合容量和尺寸。 您依赖于标准库实现的行为。 How to limit the capacity of std::vector to the number ...
  • 目前还不清楚你想如何构建所有的元素。 假设您想要矢量具有n元素和容量desired_capacity ,它可能等于n 。 如果你想要n相同的元素,试试这个: std::vector v(n, t); // creates n copies of the value t. v.reserve(desired_capacity); 如果您不想指定初始值,则可以省略: std::vector v(n); // creates n copies of T, default construct ...
  • 原因与向量扩展算法的本质有关。 初始化向量时,应用的额外容量数为0.在第i次需要扩展时,向量将其包含复制到新向量,其容量比当前大小加倍。 这种方法使得大小改变数组的整体思想非常有效,因为在摊销时间(意味着N次操作的平均时间),我们得到O(1)插入复杂度。 你可以看到,在我们向第一个向量添加一个整数后,我们得到的容量为6. http://coliru.stacked-crooked.com/a/f084820652f025b8 The reason is related to the very essence ...
  • 1)由于容量,某些内存是否被占用? 如果我没有明确保留()'d怎么办? 即使你没有调用reserve, std::string对象仍然可以为(甚至是默认构造的) std::string保留一些内存1 。 使用短字符串优化的 std::string实现也是如此 2)如果我使用std :: reserve()并且最终没有使用整个capcity那么我是在浪费内存吗? 这取决于你浪费记忆的意思; std::string动态调整其缓冲区的大小以适应std::string大小的变化。 好吧,在Short String ...
  • 您可以使用v.reserve(n + 2)更改vector的容量而不更改其大小。 查看文档以更好地了解正在发生的事情。 You can use v.reserve(n + 2) to change the vector's capacity without altering its size. Take a look at the documentation to better understand what is going on.
  • 这取决于实现,所以在切换操作系统,编译器等时不要指望相同的模式。 最常见的增长模式是1.5 * previous_capacity和2 * previous_capacity 。 在你的例子中,它似乎是前者。 有关为何选择该因子的可能解释,请参阅https://stackoverflow.com/a/1100426/784668 。 关键是它显然允许重用以前用于存储阵列的空闲内存块。 It depends on the implementation, so don't expect the same pat ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)