当前位置: 首页 > 编程日记 > 正文

C++11中std::forward_list单向链表的使用

std::forward_list是在C++11中引入的单向链表或叫正向列表。forward_list具有插入、删除表项速度快、消耗内存空间少的特点,但只能向前遍历。与其它序列容器(array、vector、deque)相比,forward_list在容器内任意位置的成员的插入、提取(extracting)、移动、删除操作的速度更快,因此被广泛用于排序算法。forward_list是一个允许在序列中任何一处位置以常量耗时插入或删除元素的顺序容器(sequence container)。forward_list可以看作是对C语言风格的单链表的封装,仅提供有限的接口,和C中它的实现相比,基本上不会有任何开销。当不需要双向迭代的时候,与std::list相比,该容器具有更高的空间利用率。

forward_list的主要缺点是不能在常量时间内随机访问任意成员,对成员的访问需要线性时间代价;以及存储链接信息需要消耗内存,特别是当包含大量的小规模成员时。forward_list处于效率考虑,有意不提供size()成员函数。获取forward_list所包含的成员个数需要用std::distance(_begin, _end)算法。forward_list中的每个元素保存了定位前一个元素及后一个元素的信息,不能进行直接随机访问操作。

Forward lists are sequence containers that allow constant time insert and erase operations anywhere within the sequence. Forward lists are implemented as singly-linked lists; Singly linked lists can store each of the elements they contain indifferent and unrelated storage locations. The ordering is kept by the association to each element of a link to the next element in the sequence.

Compared to other base standard sequence containers (array, vector and deque), forward_list perform generally better in inserting, extracting and moving elements in any position within the container, and therefore also in algorithms that make intensive use of these, like sorting algorithms.

The main drawback of forward_lists and lists compared to these other sequence containers is that they lack direct access to the elements by their position;For example, to access the sixth element in a forward_list one has to iterate from the beginning to that position, which takes linear time in the distance between these. They also consume some extra memory to keep the linking information associated to each element (which may be an important factor for large lists of small-sized elements).

一个容器就是一些特定类型对象的集合。顺序容器(sequential container)为程序员提供了控制元素存储和访问顺序的能力。这种顺序不依赖于元素的值,而是与元素加入容器时的位置相对应。

标准库中的顺序容器包括:

(1)、vector:可变大小数组。支持快速随机访问。在尾部之外的位置插入或删除元素可能很慢。

(2)、deque:双端队列。支持快速随机访问。在头尾位置插入/删除速度很快。

(3)、list:双向链表。只支持双向顺序访问。在list中任何位置进行插入/删除操作速度都很快。

(4)、forward_list:单向链表。只支持单向顺序访问。在链表任何位置进行插入/删除操作速度都很快。

(5)、array:固定大小数组。支持快速随机访问。不能添加或删除元素。

(6)、string:与vector相似的容器,但专门用于保存字符。随机访问快。在尾部插入/删除速度快。

除了固定大小的array外,其它容器都提供高效、灵活的内存管理。我们可以添加和删除元素,扩张和收缩容器的大小。容器保存元素的策略对容器操作的效率有着固定的,有时是重大的影响。在某些情况下,存储策略还会影响特定容器是否支持特定操作。

例如,string和vector将元素保存在连续的内存空间中。由于元素是连续存储的,由元素的下标来计算其地址是非常快速的。但是,在这两种容器的中间位置添加或删除元素就会非常耗时:在一次插入或删除操作后,需要移动插入/删除位置之后的所有元素,来保持连续存储。而且,添加一个元素有时可能还需要分配额外的存储空间。在这种情况下,每个元素都必须移动到新的存储空间中。

list和forward_list两个容器的设计目的是令容器任何位置的添加和删除操作都很快速。作为代价,这两个容器不支持元素的随机访问:为了访问一个元素,我们只能遍历整个容器。而且,与vector、deque和array相比,这两个容器的额外内存开销也很大。

deque是一个更为复杂的数据结构。与string和vector类似,deque支持快速的随机访问。与string和vector一样,在deque的中间位置添加或删除元素的代价(可能)很高。但是,在deque的两端添加或删除元素都是很快的,与list或forward_list添加删除元素的速度相当。

forward_list和array是新C++标准增加的类型。与内置数组相比,array是一个种更安全、更容易使用的数组类型。与内置数组类似,array对象的大小是固定的。因此,array不支持添加和删除元素以及改变容器大小的操作。forward_list的设计目标是达到与最好的手写的单向链表数据结构相当的性能。因此,forward_list没有size操作,因为保存或计算其大小就会比手写链表多出额外的开销。对其他容器而言,size保证是一个快速的常量时间的操作。

通常,使用vector是最好的选择,除法你有很好的理由选择其他容器。

以下是一些选择容器的基本原则:

(1)、除法你有很好的理由选择其他容器,否则应该使用vector;

(2)、如果你的程序有很多小的元素,且空间的额外开销很重要,则不要使用list或forward_list;

(3)、如果程序要求随机访问元素,应使用vector或deque;

(4)、如果程序要求在容器的中间插入或删除元素,应使用list或forward_list;

(5)、如果程序需要在头尾位置插入或删除元素,但不会在中间位置进行插入或删除操作,则使用deque;

(6)、如果程序只有在读取输入时才需要在容器中间位置插入元素,随后需要随机访问元素,则:首先,确定是否真的需要在容器中间位置添加元素。当处理输入数据时,通常可以很容器地向vector追加数据,然后再调用标准库的sort函数来重排容器中的元素,从而避免在中间位置添加元素。如果必须在中间位置插入元素,考虑在输入阶段使用list,一旦输入完成,将list中的内容拷贝到一个vector中。

如果你不确定应该使用哪种容器,那么可以在程序中只使用vector和list公共的操作:使用迭代器,不使用下标操作,避免随机访问。这样,在必要时选择使用vector或list都很方便。

一般来说,每个容器都定义在一个头文件中,文件名与类型名相同。即,deque定义在头文件deque中,list定义在头文件list中,以此类推。容器均定义为模板类。

顺序容器几乎可以保存任意类型的元素。特别是,我们可以定义一个容器,其元素的类型是另一个容器。这种容器的定义与任何其他容器类型完全一样:在尖括号中指定元素类型(此种情况下,是另一种容器类型)。

除了顺序容器外,标准库还定义了三个顺序容器适配器:stack、queue和priority_queue。适配器(adaptor)是标准库中的一个通用概念。容器、迭代器和函数都有适配器。本质上,一个适配器是一种机制,能使某种事物的行为看起来像另外一种事物一样。一个容器适配器接受一种已有的容器类型,使其行为看起来像一种不的类型。

下面是从其他文章中copy的std::forward_list测试代码,详细内容介绍可以参考对应的reference:

#include "forward_list.hpp"
#include <iostream>
#include <forward_list>
#include <array>
#include <functional>
#include <cmath>///
// reference: http://www.cplusplus.com/reference/forward_list/forward_list/
template<class Container>
static Container by_two(const Container& x)
{Container temp(x);for (auto& x : temp) x *= 2;return temp;
}// a predicate implemented as a function:
static bool single_digit(const int& value) { return (value<10); }// a predicate implemented as a class:
class is_odd_class
{
public:bool operator() (const int& value) { return (value % 2) == 1; }
} is_odd_object;// a binary predicate implemented as a function:
static bool same_integral_part(double first, double second)
{return (int(first) == int(second));
}// a binary predicate implemented as a class:
class is_near_class
{
public:bool operator() (double first, double second){return (fabs(first - second)<5.0);}
} is_near_object;int test_forward_list_1()
{
{ // forward_list::forward_list: Constructs a forward_list container object,// initializing its contents depending on the constructor version usedstd::forward_list<int> first;                      // default: emptystd::forward_list<int> second(3, 77);              // fill: 3 seventy-sevensstd::forward_list<int> third(second.begin(), second.end()); // range initializationstd::forward_list<int> fourth(third);            // copy constructorstd::forward_list<int> fifth(std::move(fourth));  // move ctor. (fourth wasted)std::forward_list<int> sixth = { 3, 52, 25, 90 };    // initializer_list constructorstd::cout << "first:"; for (int& x : first)  std::cout << " " << x; std::cout << '\n';std::cout << "second:"; for (int& x : second) std::cout << " " << x; std::cout << '\n';std::cout << "third:";  for (int& x : third)  std::cout << " " << x; std::cout << '\n';std::cout << "fourth:"; for (int& x : fourth) std::cout << " " << x; std::cout << '\n';std::cout << "fifth:";  for (int& x : fifth)  std::cout << " " << x; std::cout << '\n';std::cout << "sixth:";  for (int& x : sixth)  std::cout << " " << x; std::cout << '\n';
}{ // forward_list::assign: Assigns new contents to the forward_list container,// replacing its current contents, and modifying its size accordinglystd::forward_list<int> first;std::forward_list<int> second;first.assign(4, 15);                           // 15 15 15 15second.assign(first.begin(), first.end());     // 15 15 15 15first.assign({ 77, 2, 16 });                  // 77 2 16std::cout << "first contains: ";for (int& x : first) std::cout << ' ' << x;std::cout << '\n';std::cout << "second contains: ";for (int& x : second) std::cout << ' ' << x;std::cout << '\n';
}{ // forward_list::before_begin: Returns an iterator pointing to the position before the first element in the container.// forward_list::cbefore_begin: Returns a const_iterator pointing to the position before the first element in the container.std::forward_list<int> mylist = { 20, 30, 40, 50 };mylist.insert_after(mylist.before_begin(), 11);mylist.insert_after(mylist.cbefore_begin(), 19);std::cout << "mylist contains:";for (int& x : mylist) std::cout << ' ' << x;std::cout << '\n';
}{ // forward_list::begin: Returns an iterator pointing to the first element in the forward_list container.// forward_list::cbegin: Returns a const_iterator pointing to the first element in the container.// forward_list::end: Returns an iterator referring to the past-the-end element in the forward_list container// forward_list::cend: Returns a const_iterator pointing to the past-the-end element in the forward_list containerstd::forward_list<int> mylist = { 34, 77, 16, 2 };std::cout << "mylist contains:";for (auto it = mylist.begin(); it != mylist.end(); ++it)std::cout << ' ' << *it;for (auto it = mylist.cbegin(); it != mylist.cend(); ++it)std::cout << ' ' << *it;   // cannot modify *itstd::cout << '\n';
}{ // forward_list::clear: Removes all elements from the forward_list container (which are destroyed),// and leaving the container with a size of 0std::forward_list<int> mylist = { 10, 20, 30 };std::cout << "mylist contains:";for (int& x : mylist) std::cout << ' ' << x;std::cout << '\n';mylist.clear();mylist.insert_after(mylist.before_begin(), { 100, 200 });std::cout << "mylist contains:";for (int& x : mylist) std::cout << ' ' << x;std::cout << '\n';
}{ // forward_list::emplace_after: The container is extended by inserting a new element after the element at position.// This new element is constructed in place using args as the arguments for its construction.// forward_list::emplace_front: Inserts a new element at the beginning of the forward_list, right before its current first element.// This new element is constructed in place using args as the arguments for its construction.std::forward_list< std::pair<int, char> > mylist;auto it = mylist.before_begin();it = mylist.emplace_after(it, 100, 'x');it = mylist.emplace_after(it, 200, 'y');it = mylist.emplace_after(it, 300, 'z');std::cout << "mylist contains:";for (auto& x : mylist)std::cout << " (" << x.first << "," << x.second << ")";std::cout << std::endl;mylist.emplace_front(10, 'a');mylist.emplace_front(20, 'b');mylist.emplace_front(30, 'c');std::cout << "mylist contains:";for (auto& x : mylist)std::cout << " (" << x.first << "," << x.second << ")";std::cout << '\n';
}{ // forward_list::empty: Returns a bool value indicating whether the forward_list container is empty, i.e. whether its size is 0std::forward_list<int> first;std::forward_list<int> second = { 20, 40, 80 };std::cout << "first " << (first.empty() ? "is empty" : "is not empty") << std::endl;std::cout << "second " << (second.empty() ? "is empty" : "is not empty") << std::endl;
}{ // forward_list::erase_after: Removes from the forward_list container either a single element (the one after position) or a range of elements std::forward_list<int> mylist = { 10, 20, 30, 40, 50 };// 10 20 30 40 50auto it = mylist.begin();                 // ^it = mylist.erase_after(it);              // 10 30 40 50//    ^it = mylist.erase_after(it, mylist.end()); // 10 30//       ^std::cout << "mylist contains:";for (int& x : mylist) std::cout << ' ' << x;std::cout << '\n';
}{ // forward_list::front: Returns a reference to the first element in the forward_list container.std::forward_list<int> mylist = { 2, 16, 77 };mylist.front() = 11;std::cout << "mylist now contains:";for (int& x : mylist) std::cout << ' ' << x;std::cout << '\n';
}{ // forward_list::insert_after: The container is extended by inserting new elements after the element at positionstd::array<int, 3> myarray = { 11, 22, 33 };std::forward_list<int> mylist;std::forward_list<int>::iterator it;it = mylist.insert_after(mylist.before_begin(), 10);          // 10//  ^  <- itit = mylist.insert_after(it, 2, 20);                          // 10 20 20//        ^it = mylist.insert_after(it, myarray.begin(), myarray.end()); // 10 20 20 11 22 33//                 ^it = mylist.begin();                                             //  ^it = mylist.insert_after(it, { 1, 2, 3 });                        // 10 1 2 3 20 20 11 22 33//        ^std::cout << "mylist contains:";for (int& x : mylist) std::cout << ' ' << x;std::cout << '\n';
}{ // forward_list::max_size: Returns the maximum number of elements that the forward_list container can holdstd::forward_list<int> mylist = { 2, 16, 77 };std::cout << "mylist max size:" << mylist.max_size() << std::endl;
}{ // forward_list::merge: Merges x into the forward_list by transferring all of its elements at their respective ordered positions// into the container (both containers shall already be ordered)// forward_list::sort: Sorts the elements in the forward_list, altering their position within the containerstd::forward_list<double> first = { 4.2, 2.9, 3.1 };std::forward_list<double> second = { 1.4, 7.7, 3.1 };std::forward_list<double> third = { 6.2, 3.7, 7.1 };first.sort();second.sort();first.merge(second);std::cout << "first contains:";for (double& x : first) std::cout << " " << x;std::cout << std::endl;first.sort(std::greater<double>());third.sort(std::greater<double>());first.merge(third, std::greater<double>());std::cout << "first contains:";for (double& x : first) std::cout << " " << x;std::cout << std::endl;
}{ // forward_list::operator=: Assigns new contents to the container, replacing its current contentsstd::forward_list<int> first(4);      // 4 intsstd::forward_list<int> second(3, 5);   // 3 ints with value 5first = second;                        // copy assignmentsecond = by_two(first);                // move assignmentstd::cout << "first: ";for (int& x : first) std::cout << ' ' << x;std::cout << '\n';std::cout << "second: ";for (int& x : second) std::cout << ' ' << x;std::cout << '\n';
}{ // forward_list::pop_front: Removes the first element in the forward_list container, effectively reducing its size by one.std::forward_list<int> mylist = { 10, 20, 30, 40 };std::cout << "Popping out the elements in mylist:";while (!mylist.empty()) {std::cout << ' ' << mylist.front();mylist.pop_front();}std::cout << '\n';
}{ // forward_list::push_front: Inserts a new element at the beginning of the forward_list, right before its current first element.// The content of val is copied (or moved) to the inserted elementusing namespace std;forward_list<int> mylist = { 77, 2, 16 };mylist.push_front(19);mylist.push_front(34);std::cout << "mylist contains:";for (int& x : mylist) std::cout << ' ' << x;std::cout << '\n';
}{ // forward_list::remove: Removes from the container all the elements that compare equal to val.// This calls the destructor of these objects and reduces the container size by the number of elements removedstd::forward_list<int> mylist = { 10, 20, 30, 40, 30, 20, 10 };mylist.remove(20);std::cout << "mylist contains:";for (int& x : mylist) std::cout << ' ' << x;std::cout << '\n';
}{ // forward_list::remove_if: Removes from the container all the elements for which Predicate pred returns true.// This calls the destructor of these objects and reduces the container size by the number of elements removed.std::forward_list<int> mylist = { 7, 80, 7, 15, 85, 52, 6 };mylist.remove_if(single_digit);      // 80 15 85 52mylist.remove_if(is_odd_object);     // 80 52std::cout << "mylist contains:";for (int& x : mylist) std::cout << ' ' << x;std::cout << '\n';
}{ // forward_list::resize: Resizes the container to contain n elementsstd::forward_list<int> mylist = { 10, 20, 30, 40, 50 };// 10 20 30 40 50mylist.resize(3);             // 10 20 30mylist.resize(5, 100);        // 10 20 30 100 100std::cout << "mylist contains:";for (int& x : mylist) std::cout << ' ' << x;std::cout << '\n';
}{ // forward_list::reverse: Reverses the order of the elements in the forward_list container.std::forward_list<int> mylist = { 10, 20, 30, 40 };mylist.reverse();std::cout << "mylist contains:";for (int& x : mylist) std::cout << ' ' << x;std::cout << '\n';
}{ // forward_list::splice_after: Transfers elements from fwdlst into the container inserting them after the element pointed by position.std::forward_list<int> first = { 1, 2, 3 };std::forward_list<int> second = { 10, 20, 30 };auto it = first.begin();  // points to the 1first.splice_after(first.before_begin(), second);// first: 10 20 30 1 2 3// second: (empty)// "it" still points to the 1 (now first's 4th element)second.splice_after(second.before_begin(), first, first.begin(), it);// first: 10 1 2 3// second: 20 30first.splice_after(first.before_begin(), second, second.begin());// first: 30 10 1 2 3// second: 20// * notice that what is moved is AFTER the iteratorstd::cout << "first contains:";for (int& x : first) std::cout << " " << x;std::cout << std::endl;std::cout << "second contains:";for (int& x : second) std::cout << " " << x;std::cout << std::endl;
}{ // forward_list::swap: Exchanges the content of the container by the content of fwdlst,// which is another forward_list object of the same type. Sizes may differstd::forward_list<int> first = { 10, 20, 30 };std::forward_list<int> second = { 100, 200 };std::forward_list<int>::iterator it;first.swap(second);std::swap(first, second);std::cout << "first contains:";for (int& x : first) std::cout << ' ' << x;std::cout << '\n';std::cout << "second contains:";for (int& x : second) std::cout << ' ' << x;std::cout << '\n';
}{ // forward_list::unique: Remove duplicate valuesstd::forward_list<double> mylist = { 15.2, 73.0, 3.14, 15.85, 69.5,73.0, 3.99, 15.2, 69.2, 18.5 };mylist.sort();                       //   3.14,  3.99, 15.2, 15.2, 15.85//  18.5,  69.2,  69.5, 73.0, 73.0mylist.unique();                     //   3.14,  3.99, 15.2, 15.85//  18.5,  69.2,  69.5, 73.0mylist.unique(same_integral_part);  //  3.14, 15.2, 18.5,  69.2, 73.0mylist.unique(is_near_object);      //  3.14, 15.2, 69.2std::cout << "mylist contains:";for (double& x : mylist) std::cout << ' ' << x;std::cout << '\n';
}{ // Performs the appropriate comparison operation between the forward_list containers lhs and rhs.std::forward_list<int> a = { 10, 20, 30 };std::forward_list<int> b = { 10, 20, 30 };std::forward_list<int> c = { 30, 20, 10 };if (a == b) std::cout << "a and b are equal\n";if (b != c) std::cout << "b and c are not equal\n";if (b<c) std::cout << "b is less than c\n";if (c>b) std::cout << "c is greater than b\n";if (a <= b) std::cout << "a is less than or equal to b\n";if (a >= b) std::cout << "a is greater than or equal to b\n";
}{ // get forward_list elements sizestd::forward_list<int> a = { 10, 20, 30 };size_t size = std::distance(a.begin(), a.end());std::cout << "a size: " << size << std::endl;
}return 0;
}
GitHub: https://github.com/fengbingchun/Messy_Test

相关文章:

即学即用的30段Python实用代码

&#xff08;图片付费下载自视觉中国&#xff09;原标题 | 30 Helpful Python Snippets That You Can Learn in 30 Seconds or Less作 者 | Fatos Morina翻 译 | Pita & AI开发者Python是目前最流行的语言之一&#xff0c;它在数据科学、机器学习、web开发、脚本编写、自…

如何配置IntelliJ IDEA发布JavaEE项目?

一、以war的形式运行项目 步骤1 新建或者导入项目后&#xff0c;选择File菜单-》Project Structure...&#xff0c;如下图&#xff1a; 步骤2 配置项目类型&#xff0c;名字可以自定义&#xff1a; 说明&#xff1a;这里的Artifact如果没有配置好的话&#xff0c;配置Tomcat时没…

网络分布式软件bonic清除

近期&#xff0c;有一款网格计算软件&#xff0c;在很多服务器上进行了部署&#xff0c;利用cpu进行运算。虽然未构成安全隐患&#xff0c;但是比较消耗资源&#xff0c;影响设备正常运行。今天对设备彻底检查&#xff0c;发现了一个分布式计算软件boinc&#xff0c;他是利用网…

C++/C++11中std::list双向链表的使用

std::list是双向链表&#xff0c;是一个允许在序列中任何一处位置以常量耗时插入或删除元素且可以双向迭代的顺序容器。std::list中的每个元素保存了定位前一个元素及后一个元素的信息&#xff0c;允许在任何一处位置以常量耗时进行插入或删除操作&#xff0c;但不能进行直接随…

React组件设计之边界划分原则

简述 结合SOLID中的单一职责原则来进行组件的设计 Do one thing and do it well javaScript作为一个弱类型并在函数式和面对对象的领域里疯狂试探语言。SOLID原则可能与其他语言例如&#xff08;java&#xff09;的表现可能是不同的。不过作为软件开发领域通用的原则&#xff0…

阿里AI labs发布两大天猫精灵新品,将与平头哥共同定制智能语音芯片

作者 | 夕颜出品 | AI科技大本营&#xff08;ID:rgznai100&#xff09;2019 年&#xff0c;去年刮起的一阵智能音箱热浪似乎稍微冷却下来&#xff0c;新产品不再像雨后春笋一样层出不穷&#xff0c;挺过市场洗礼的产品更是凤毛麟角&#xff0c;这些产品的性能、技术支持和体验基…

js 中文匹配正则

为什么80%的码农都做不了架构师&#xff1f;>>> /^[\u4e00-\u9fa5]{2,4}$/gi.test() 匹配中文正则 转载于:https://my.oschina.net/fedde/blog/211852

Caffe中对cifar10执行train操作

参考Caffe source中examples/cifar10目录下内容。cifar10是一个用于普通物体识别的数据集&#xff0c;cifar10被分为10类,分别为airplane、automobile、bird、cat、deer、dog、frog、horse、ship、truck&#xff0c;关于cifar10的详细介绍可以参考&#xff1a; http://blog.csd…

解决掉这些痛点和难点,让知识图谱不再是“噱头”

&#xff08;图片付费下载自视觉中国&#xff09;作者| 夕颜出品| AI科技大本营&#xff08;ID:rgznai100&#xff09;2012 年&#xff0c;谷歌正式提出知识图谱的概念&#xff0c;当时&#xff0c;研究人员的主要目的是用来优化搜索引擎技术。今年初&#xff0c;谷歌前员工&am…

mongodb使用常用语法,持续更新

设置快捷命令D:\mongodb4.0.8\bin>mongod --config "D:\mongodb4.0.8\mongo.conf" --auth --install --serviceName "MongoDB"mongodb配置文件#数据库路径dbpathD:\mongodb4.0.8\data\db#日志输出文件路径logpathD:\mongodb4.0.8\data\log\MongoDB.log#…

Android之NDK开发的简单实例

NDK全称为Native Development Kit&#xff0c;是本地开发工具集。在Android开发中&#xff0c;有时为了能更好的重用以前的C/C的代码&#xff0c;需要将这些代码编译成相应的so&#xff0c;然后通地JNI以供上层JAVA调用。当然&#xff0c;也有的是为了更高的保护性和安全性。下…

阿里披露AI完整布局,飞天AI平台首次亮相

作者 | 夕颜编辑 | 唐小引出品 | AI 科技大本营&#xff08;ID:rgznai100&#xff09;9 月 26 日上午&#xff0c;在云栖大会阿里云飞天智能主论坛上&#xff0c;年轻的阿里巴巴副总裁、阿里云智能计算平台事业部总经理、高级研究员贾扬清与其在 Facebook 的老同事—— Faceboo…

使用Caffe基于cifar10进行物体识别

在http://blog.csdn.net/fengbingchun/article/details/72953284中对cifar10进行train&#xff0c;这里通过train得到的model&#xff0c;对图像进行识别。cifar10数据集共包括10类&#xff0c;按照0到9的顺序依次为airplane(飞机)、automobile(轿车)、bird(鸟)、cat(猫)、deer…

SoJpt Boot 2.3-3.8 发布,Spring Boot 使用 Jfinal 特性极速开发

SoJpt Boot 2.3-3.8 发布了。SoJpt Boot 基于 JFinal 与 Spring Boot制作, 实现了 Spring Boot 与 Jfinal 的混合双打,使 Spring Boot 下的开发者能够体验 Jfinal 的极速开发特性。新版更新内容如下&#xff1a; SoJpt-Boot-2.3-3.8 changelog 1、加入事务注解,Tx(value"c…

PL/SQL程序设计 第七章 包的创建和应用

7.1 引言包是一组相关过程、函数、变量、常量和游标等PL/SQL程序设计元素的组合&#xff0c;它具有面向对象程序设计语言的特点&#xff0c;是对这些PL/SQL 程序设计元素的封装。包类似于C和JAVA语言中的类&#xff0c;其中变量相当于类中的成员变量&#xff0c;过程和函数相当…

C++11中头文件chrono的使用

在C11中&#xff0c;<chrono>是标准模板库中与时间有关的头文件。该头文件中所有函数与类模板均定义在std::chrono命名空间中。 std::chrono是在C11中引入的&#xff0c;是一个模板库&#xff0c;用来处理时间和日期的Time library。要使用chrono库&#xff0c;需要incl…

为什么平头哥做芯片如此迅猛?

作者 | 胡巍巍 发自杭州云栖大会责编 | 唐小引来源 | CSDN&#xff08;ID&#xff1a;CSDNnews&#xff09;2018年10月31日&#xff0c;阿里旗下的平头哥半导体有限公司成立。如今&#xff0c;平头哥成立不到一年&#xff0c;就已成绩斐然。2019年9月25日&#xff0c;阿里巴巴旗…

Vue 组件库 heyui@1.18.0 发布,新增地址选择、图片预览组件

开发四年只会写业务代码&#xff0c;分布式高并发都不会还做程序员&#xff1f; 新增 CategoryPicker 新增组件 CategoryPicker&#xff0c;地址级联组件的最佳方案。 <CategoryPicker :option"option" v-model"value"/> 相关文档 ImagePreview 新…

HTML5 Dashboard – 那些让你激动的 Web 技术

HTML5 Dashboard 是一个 Mozilla 推出的项目&#xff0c;里面展示了最前沿的 HTML5&#xff0c;CSS3&#xff0c;JavaScript 技术。每一项技术都有简洁&#xff0c;在线演示以及详细的文档链接。这些技术将成为未来一段时间 Web 开发的顶尖技术&#xff0c;如果不想落伍的话就赶…

计算机解决问题没有奇技淫巧,但动态规划还是有点套路

作者 | labuladong来源 | labuladong&#xff08;ID:labuladong&#xff09; 【导读】动态规划算法似乎是一种很高深莫测的算法&#xff0c;你会在一些面试或算法书籍的高级技巧部分看到相关内容&#xff0c;什么状态转移方程&#xff0c;重叠子问题&#xff0c;最优子结构等高…

idea下,Jetty采用main方法启动web项目

为什么80%的码农都做不了架构师&#xff1f;>>> 对于maven多模块的spring web项目&#xff0c;本地开发时&#xff0c;启动的方式一般有如下几种&#xff1a; 使用容器&#xff08;tomcat/jetty/resin等&#xff09;&#xff0c;该方式需要ide支持&#xff0c;而社…

概率论中均值、方差、标准差介绍及C++/OpenCV/Eigen的三种实现

概率论是用于表示不确定性声明(statement)的数学框架。它不仅提供了量化不确定性的方法&#xff0c;也提供了用于导出新的不确定性声明的公理。在人工智能领域&#xff0c;概率论主要有两种用途。首先&#xff0c;概率法则告诉我们AI系统如何推理&#xff0c;据此我们设计一些算…

[转]CentOS 5.5下FTP安装及配置

一、FTP的安装 1、检测是否安装了FTP : [rootlocalhost ~]# rpm -q vsftpd vsftpd-2.0.5-16.el5_5.1 否则显示:[rootlocalhost ~]# package vsftpd is not installed 查看ftp运行状态 service vsftpd status 2、如果没安装FTP&#xff0c;运行yum install vsftpd命令进行安装 如…

C++11中头文件thread的使用

C11中加入了<thread>头文件&#xff0c;此头文件主要声明了std::thread线程类。C11的标准类std::thread对线程进行了封装。std::thread代表了一个线程对象。应用C11中的std::thread便于多线程程序的移值。 <thread>是C标准程序库中的一个头文件&#xff0c;定义了…

python3 urllib 类

urllib模块中的方法 1.urllib.urlopen(url[,data[,proxies]]) 打开一个url的方法&#xff0c;返回一个文件对象&#xff0c;然后可以进行类似文件对象的操作。本例试着打开google >>> import urllib >>> f urllib.urlopen(http://www.google.com.hk/) >&…

阿里飞天大数据飞天AI平台“双生”系统正式发布,9大全新数据产品集中亮相

作者 | 夕颜 责编 | 唐小引 出品 | AI科技大本营&#xff08;ID:rgznai100&#xff09; 如今&#xff0c;大数据和 AI 已经成为两个分不开的词汇&#xff0c;没有大数据&#xff0c;AI 就失去了根基&#xff1b;没有 AI&#xff0c;数据不会呈现爆发式的增长。如何将 AI 与大…

关于JavaScript的闭包(closure)

&#xff08;转载自阮一峰博客&#xff09; 闭包&#xff08;closure&#xff09;是Javascript语言的一个难点&#xff0c;也是它的特色&#xff0c;更是函数式编程的重要思想之一&#xff0c;很多高级应用都要依靠闭包实现。 下面就是我的学习笔记&#xff0c;对于Javascript初…

Vagrant控制管理器——“Hobo”

Hobo是控制Vagrant盒子和在Mac上编辑Vagrantfiles的最佳和最简单的方法。您可以快速启动&#xff0c;停止和重新加载您的Vagrant机器。您可以从头开始轻松创建新的Vagrantfile。点击进入&#xff0c;尽享Hobo for Mac全部功能&#xff01; Hobo做什么&#xff1f; 启动&#xf…

微众银行AI团队开源联邦学习框架,并发布《联邦学习白皮书1.0》

&#xff08;图片由AI科技大本营付费下载自视觉中国&#xff09;编辑 | Jane来源 | 《联邦学习白皮书1.0》出品 | AI科技大本营(ID&#xff1a;rgznai100&#xff09;【导语】2019年&#xff0c;联邦学习成为业界技术研究与应用的焦点。近日&#xff0c;微众银行 AI 项目组编制…

C++11中头文件atomic的使用

原子库为细粒度的原子操作提供组件&#xff0c;允许无锁并发编程。涉及同一对象的每个原子操作&#xff0c;相对于任何其他原子操作是不可分的。原子对象不具有数据竞争(data race)。原子类型对象的主要特点就是从不同线程访问不会导致数据竞争。因此从不同线程访问某个原子对象…