lp: add repeatable fields to a packet in the order they were added
refs #3931
Change-Id: I832252712ff45928ab50ff93f5b37bd44807662d
diff --git a/src/lp/packet.hpp b/src/lp/packet.hpp
index bc35122..e43652d 100644
--- a/src/lp/packet.hpp
+++ b/src/lp/packet.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -165,10 +165,8 @@
FIELD::encode(buffer, value);
Block block = buffer.block();
- Block::element_const_iterator pos = std::lower_bound(m_wire.elements_begin(),
- m_wire.elements_end(),
- FIELD::TlvType::value,
- comparePos);
+ auto pos = std::upper_bound(m_wire.elements_begin(), m_wire.elements_end(),
+ FIELD::TlvType::value, comparePos);
m_wire.insert(pos, block);
return *this;
@@ -213,7 +211,7 @@
private:
static bool
- comparePos(const Block& first, const uint64_t second);
+ comparePos(uint64_t first, const Block& second);
private:
mutable Block m_wire;