position

STL源码剖析——序列式容器#2 List

妖精的绣舞 提交于 2019-12-02 11:49:32
  list就是链表的实现,链表是什么,我就不再解释了。list的好处就是每次插入或删除一个元素,都是常数的时空复杂度。但遍历或访问就需要O(n)的时间。   List本身其实不难理解,难点在于某些功能函数的实现上,例如我们会在最后讨论的迁移函数splice()、反转函数reverse()、排序函数sort()等等。 list的结点   设计过链表的人都知道,链表本身和链表结点是不一样的结构,需要分开设计,这里的list也不例外,以下是STL list的结点结构: 1 template <class T> 2 struct __list_node { 3 typedef void* void_pointer; 4 void_pointer next; 5 void_pointer prev; 6 T data; 7 };   从结点结构可以看出,list是一个双向链表,有指向前一结点的prev指针,指向下一结点的next指针。 list的迭代器   显然,list的迭代器本身是什么类型早已由其本身的数据结构所决定,list的双向链表,不支持随机存取,只能是双向迭代器(Bidirectional Iterators)。另外,list的迭代器应该支持正确的递增、递减、取值、成员取用等操作。   以下是list迭代器的源码: 1 template<class T, class Ref,

CSS - div aligning to the bottom of parent div (inline-block)

删除回忆录丶 提交于 2019-12-02 11:23:16
I know this html is sloppy, with some extra divs that are unnecessary, but regardless, I can't understand why the div with ID "info_box_right" is aligning to the bottom of the parent div (you can see the "text" aligned to the bottom at the below jsfiddle example). Any ideas how I can get it to align to the top of its parent? http://jsfiddle.net/taddme0y/1/ HTML: <div id="info_container" > <div id="info_box"> <hr class="info_box_hr" noshade> <a id="info_box_title"></a> <hr class="info_box_hr" noshade> <div id="info_box_wrapper"> <div id="info_box_left"> <div class="info_box_sub_wrapper"> <a id=

nio(1)基本介绍

为君一笑 提交于 2019-12-02 11:03:11
目录 一 NIO介绍 二 Channel 三 Buffer 四 Selector SelectionKey select() 参考 一 NIO介绍 nio和io的区别: 1.NIO是面向块的,IO是面向流的。面向流意味着每次从流中读一个或多个字节,直至读取所有字节,它们没有被缓存在任何地方。而面向块则会先把数据读到一个换乘区,这样NIO就可以前后移动读取数据,更加灵活和方便。 2.IO是阻塞的,NIO可以是不阻塞的(在网络编程中)。占用的系统资源更少。 二 Channel Channel是双向的,既可以用来进行读操作,又可以用来进行写操作。 NIO中的Channel的主要实现有: FileChannel DatagramChannel SocketChannel ServerSocketChannel 这里看名字就可以看出来:分别对应文件IO、UDP和TCP(Server和Client) FileChannel最基本的示例 RandomAccessFile aFile = new RandomAccessFile ( "data/nio-data.txt" , "rw" ) ; FileChannel inChannel = aFile . getChannel ( ) ; ByteBuffer buf = ByteBuffer . allocate ( 48 ) ; int

css sprites拼合

你离开我真会死。 提交于 2019-12-02 10:59:19
一、什么是css sprites css sprites直译过来就是CSS精灵。通常被解释为“CSS图像拼合”或“CSS贴图定位”。就是把网页中一些背景图片整合拼合成一张图片中,再利用DIV CSS的“background-image”,“background- repeat”,“background-position”的组合进行背景定位,background-position可以用数字能精确的定位出背景图片在布局盒子对象位置。 二、适合与不适合DIV CSS sprites拼合布局 1、适合:一般小图标素材 小的图标ico类素材,一般图标很小十多像素几十像素的宽度高度,这种适合拼合成一张图实现sprites background背景定位布局。多小ico太多自然加载网页时瞬间会消耗些http iis链接数,但很快加载完又会释放。 2、不适合:大图大背景 大背景一般用于网页背景,拼合时,设置为网页背景时所有背景都会显示出来。大图拼接拼合会增大图片大小,网络带宽不好的访问者访问时由于背景图大文件大会加载稍慢些,所以大图不推荐拼接拼合来使用css sprites背景定位布局。 3、sprites适合推荐小结 一般此sprites拼合布局用于局部小盒子布局不适合大背景大布局背景使用。比如小局部布局小图标背景、小导航背景等DIVCSS布局。 三、div css

CSS实现水平垂直居中的几种方式

拥有回忆 提交于 2019-12-02 10:58:39
准备工作,假设有如下html <div class="wrapper"> <div class="box"> </div> </div> 需要设置宽高 1.position + 负margin .wrapper { position : relative ; } .box { width : 100px ; height : 100px ; position : absolute ; left : 50% ; top : 50% ; margin-left : -50px ; margin-top : -50px ; } 2. position + margin:auto .wrapper { position : relative ; } .box { width : 100px ; height : 100px ; position : absolute ; left : 0 top : 0 ; right : 0 ; bottom : 0 ; margin : auto ; } 3.position + calc() .wrapper { position : relative ; } .box { width : 100px ; height : 100px ; position : absolute ; left : calc ( 50% - 50px ) ; top :

9.7. Relocation and Position Independent Code (PIC)

£可爱£侵袭症+ 提交于 2019-12-02 10:51:54
9.7. Relocation and Position Independent Code (PIC) In this section we’ll investigate the difference between position independent code (known as “PIC” from here on) and non-position-independent code and how both affect relocation. 在本节中,我们将研究位置无关代码(此处称为“PIC”)与位置无关代码之间的区别以及两者如何影响重定位。 9.7.1. PIC vs. non-PIC Much of the complexity in the ELF standard is due to the need to load shared libraries at different locations in a process’ address space. Objects built to be position-independent are specifically meant to be loaded anywhere in the address space. As discussed earlier, the code in ELF files

前端整理——css部分

让人想犯罪 __ 提交于 2019-12-02 10:49:58
前端整理——css部分 (1)盒模型(普通盒模型、怪异盒模型) 1、元素的content(内容)、padding(内边距)、border(边框)、margin(外边距)构成了CSS盒模型 2、IE盒模型和W3C盒模型 1)IE盒模型是怪异模式下的盒模型,W3C盒模型是标准模式下的盒模型; 2)IE盒模型的width/height包含了content的width/heigh+padding+border W3C盒模型的width/height只是content的width/height 3、CSS3中的box-sizing 不同的人有不同的习惯,在css3中增加了box-sizing:content-box(遵循W3C盒模型)| border-box(遵循ie盒模型)|inherit(该属性的值从父元素继承) (2)如何让元素水平居中 1、绝对定位实现水平垂直居中: <span style="color:#000000"><span style="color:#000000"><code>position: absolute; top: 0; right: 0; bottom: 0; left: 0; margin: auto;</code></span></span> 注意: 1>对父元素要使用 position: relative; 对子元素要使用 position:

matplotlib画图、标点、打标签

ε祈祈猫儿з 提交于 2019-12-02 10:45:35
Rendering 这是想要的效果: Notes 记录几个功能的做法: 函数作图 座标轴移到过原点,上、下边框去掉 标出一个点 虚线描出这个点的横、纵坐标所在 给这个点打标签 图片标题 保存 Code import matplotlib . pyplot as plt import numpy as np fig = plt . figure ( ) # 函数图 x = np . arange ( 0 , 3 , 0.01 ) y = x ** 2 - 3 * x + 2 plt . plot ( x , y ) # 标题 plt . title ( 'x^2 - 3x + 2' ) # 标点 plt . scatter ( [ 1.5 ] , [ - 0.25 ] , s = 25 , c = 'r' ) # stroke, colour # 虚线定位:两点确定一条直线 plt . plot ( [ 0 , 1.5 ] , [ - 0.25 , - 0.25 ] , c = 'b' , linestyle = '--' ) plt . plot ( [ 1.5 , 1.5 ] , [ 0 , - 0.25 ] , c = 'b' , linestyle = '--' ) # 点的标签(座标中加减的 `0.15` 是显示位置的偏移,避免挡住点) plt . text ( 1.5 +

Is it possible to use position relative more than once in the same html page?

被刻印的时光 ゝ 提交于 2019-12-02 10:07:52
I am using 'position relative' and 'position absolute' on my master page. I have a page that use the above master page, And I am trying to use in this page the 'Position relative' and 'position absolute' again for 2 other elements, but the element below ('position absolute') in this page is not placed according to the element above his ('position relative') and instead it refers to the 'position relative' of the element in the master page.. Hope is was not too clumsy explanation.. Is it possible to use 'position relative' more than once on the same HTML page??? If so, how?? html codes <html>