首页 \ 问答 \ 重叠的vector :: insert的行为(The behavior of overlapped vector::insert)

重叠的vector :: insert的行为(The behavior of overlapped vector::insert)

C ++标准在哪里声明传递给std::vector::insert的迭代器对不能与原始序列重叠?

编辑:为了阐述,我很确定标准不需要标准库来处理这样的情况:

std::vector<int> v(10);
std::vector<int>::iterator first = v.begin() + 5;
std::vector<int>::iterator last = v.begin() + 8;
v.insert(v.begin() + 2, first, last);

但是,我无法在标准中找到任何内容,这会阻止范围[first, last)[v.begin(), v.end())重叠。


Where does the C++ standard declare that the pair of iterators passed to std::vector::insert must not overlap the original sequence?

Edit: To elaborate, I'm pretty sure that the standard does not require the standard library to handle situations like this:

std::vector<int> v(10);
std::vector<int>::iterator first = v.begin() + 5;
std::vector<int>::iterator last = v.begin() + 8;
v.insert(v.begin() + 2, first, last);

However, I was unable to find anything in the standard, that would prohibit the ranges [first, last) and [v.begin(), v.end()) to overlap.


原文:https://stackoverflow.com/questions/1329181
更新时间:2023-04-11 09:04

最满意答案

我想我们可以使用本地url系统引用js文件。 例如,如果您将这些文件放在同一位置,则可以使用{path to file} /javascriptfile.js样式进行引用

<link rel="stylesheet" type="text/css" href="../../libraries/dhtmlxCalendar/dhtmlxCalendar/codebase/dhtmlxcalendar.css">
<link rel="stylesheet" type="text/css" href="../../libraries/dhtmlxCalendar/dhtmlxCalendar/codebase/skins/dhtmlxcalendar_dhx_skyblue.css">
<script src="../../libraries/dhtmlxCalendar/dhtmlxCalendar/codebase/dhtmlxcalendar.js"></script>

I think we can refer js files using the local url system. As a example if you have those files in the same location you can refer using {path to file}/javascriptfile.js style

<link rel="stylesheet" type="text/css" href="../../libraries/dhtmlxCalendar/dhtmlxCalendar/codebase/dhtmlxcalendar.css">
<link rel="stylesheet" type="text/css" href="../../libraries/dhtmlxCalendar/dhtmlxCalendar/codebase/skins/dhtmlxcalendar_dhx_skyblue.css">
<script src="../../libraries/dhtmlxCalendar/dhtmlxCalendar/codebase/dhtmlxcalendar.js"></script>

相关问答

更多
  • 要向PHP发送Javascript值,您需要使用AJAX。 JS: $(".btn").click(function(e) { var url = window.location.href; $.post('pageA.php', {url : url}); } 在您的服务器上,您需要收到帖子中发送的网址,如下所示: PHP: $_SESSION['url'] = $_POST['url']; 希望这可以帮助。 To send a Javascript value to PHP you' ...
  • 詹姆斯帕多尔已经解决了这个问题。 简而言之,您可以使用document.createElement()创建一个锚点元素,然后可以轻松访问其几个本地属性,例如protocol , port和hostname 。 欲了解更多信息,请访问: http : //james.padolsey.com/javascript/parsing-urls-with-the-dom/ James Padolsey had tackled this problem. In a nutshell, you can create a ...
  • document.referrer 在许多情况下,如果他们通过点击链接到达当前页面(直接输入到地址栏中,或者我相信在某些情况下,通过提交表单?),您将获得用户访问的最后一页的URL。 由DOM Level 2指定。 更多在这里 window.history允许导航,但由于安全和隐私的原因,不能访问会话中的URL。 如果更详细的网址记录可用,那么您访问的每个网站都可以看到您之前所有的其他网站。 如果您正在处理移动您自己的站点的状态,那么使用其中一种常规会话管理技术可能不那么脆弱,当然更有用:Cookie数据 ...
  • 在现代浏览器(IE8 +,FF3.6 +,Chrome)中,您只需在window上收听hashchange事件即可。 在一些旧的浏览器中,您需要一个持续检查location.hash的计时器。 如果你使用的是jQuery,那就有一个插件 ,这样做完全是这样的。 In modern browsers(IE8+, FF3.6+, Chrome), you can just listen to the hashchange event on window. In some old browsers, you ne ...
  • 我想我们可以使用本地url系统引用js文件。 例如,如果您将这些文件放在同一位置,则可以使用{path to file} /javascriptfile.js样式进行引用
    exec返回匹配项,如果未找到匹配项,则返回null。 所以你需要保持exec直到它返回null。 var myRe = /\?*([^=]*)=([^&]*)/; var myArray; while((myArray = myRe.exec("?page=3&Name=Alex")) !== null) { for(var i=1;i
  • 听起来你正在搜索indexOf 。 请注意,它不是document.url ,而是document.URL : if (document.URL.indexOf('search.php') == -1) { window.location = 'search.php'; } 注意 :这也符合以下内容: http://www.domain.com/search.php http://www.domain.com/index.php?page=search.php&test http://www.do ...
  • 您必须为包含此类URL的每个模板修改控制器,并确保将供应商名称设置为模板可访问的PHP变量: $this->data['vendor'] = $vendor_information['name']; 假设供应商名称存储在索引name下的变量$vendor_name 。 这只是一个例子。 现在,在每个模板中使用JS部分标识此类URL: $.ajax({ url: 'index.php?route=checkout/cart/add' // + ... // ... }); 并将其更改为: ...
  • //var url = window.location.href; var url = "http://www.website.com/example?something=abc&a=b"; var attributes = url.split("?")[1].split("&"); var keyValue = {}; for(i in attributes) { var pair = attributes[i].split("="); keyValue[pair[0]] = pair[1 ...
  • var parser = document.createElement('a'); parser.href = "http://example.com:3000/pathname/?search=test#hash"; parser.protocol; // => "http:" parser.host; // => "example.com:3000" parser.hostname; // => "example.com" parser.port; // => "3000" parse ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。