src: Remove unnecessary uses of boost::cref in make_shared and replace boost::cref/boost::ref with just cref/ref

In some cases, due to argument-dependent lookup, it is necessary to use
ndn::ref, instead of just ref.

Change-Id: I682180a007609535855f77511b49622154ad4f11
Refs: #1591
diff --git a/daemon/face/ethernet-factory.cpp b/daemon/face/ethernet-factory.cpp
index 6809e6c..0408f03 100644
--- a/daemon/face/ethernet-factory.cpp
+++ b/daemon/face/ethernet-factory.cpp
@@ -47,11 +47,9 @@
     return face;
 
   shared_ptr<boost::asio::posix::stream_descriptor> socket =
-    make_shared<boost::asio::posix::stream_descriptor>(boost::ref(getGlobalIoService()));
+    make_shared<boost::asio::posix::stream_descriptor>(ref(getGlobalIoService()));
 
-  face = make_shared<EthernetFace>(boost::cref(socket),
-                                   boost::cref(interface),
-                                   boost::cref(address));
+  face = make_shared<EthernetFace>(socket, interface, address);
   face->onFail += bind(&EthernetFactory::afterFaceFailed,
                        this, name, address);
   m_multicastFaces[std::make_pair(name, address)] = face;
diff --git a/daemon/face/face.cpp b/daemon/face/face.cpp
index 46dbcf6..75600b4 100644
--- a/daemon/face/face.cpp
+++ b/daemon/face/face.cpp
@@ -40,10 +40,10 @@
   , m_localUri(localUri)
   , m_isOnDemand(false)
 {
-  onReceiveInterest += bind(&increaseCounter, boost::ref(m_counters.getNInInterests()));
-  onReceiveData     += bind(&increaseCounter, boost::ref(m_counters.getNInDatas()));
-  onSendInterest    += bind(&increaseCounter, boost::ref(m_counters.getNOutInterests()));
-  onSendData        += bind(&increaseCounter, boost::ref(m_counters.getNOutDatas()));
+  onReceiveInterest += bind(&increaseCounter, ref(m_counters.getNInInterests()));
+  onReceiveData     += bind(&increaseCounter, ref(m_counters.getNInDatas()));
+  onSendInterest    += bind(&increaseCounter, ref(m_counters.getNOutInterests()));
+  onSendData        += bind(&increaseCounter, ref(m_counters.getNOutDatas()));
 }
 
 Face::~Face()
diff --git a/daemon/face/tcp-channel.cpp b/daemon/face/tcp-channel.cpp
index 708f36b..cd2fb4f 100644
--- a/daemon/face/tcp-channel.cpp
+++ b/daemon/face/tcp-channel.cpp
@@ -48,7 +48,7 @@
                    const ConnectFailedCallback& onAcceptFailed,
                    int backlog/* = tcp::acceptor::max_connections*/)
 {
-  m_acceptor = make_shared<ip::tcp::acceptor>(boost::ref(getGlobalIoService()));
+  m_acceptor = make_shared<ip::tcp::acceptor>(ref(getGlobalIoService()));
   m_acceptor->open(m_localEndpoint.protocol());
   m_acceptor->set_option(ip::tcp::acceptor::reuse_address(true));
   if (m_localEndpoint.address().is_v6())
@@ -59,7 +59,7 @@
   m_acceptor->listen(backlog);
 
   shared_ptr<ip::tcp::socket> clientSocket =
-    make_shared<ip::tcp::socket>(boost::ref(getGlobalIoService()));
+    make_shared<ip::tcp::socket>(ref(getGlobalIoService()));
   m_acceptor->async_accept(*clientSocket,
                            bind(&TcpChannel::handleSuccessfulAccept, this, _1,
                                 clientSocket,
@@ -81,10 +81,10 @@
   }
 
   shared_ptr<ip::tcp::socket> clientSocket =
-    make_shared<ip::tcp::socket>(boost::ref(getGlobalIoService()));
+    make_shared<ip::tcp::socket>(ref(getGlobalIoService()));
 
   shared_ptr<ndn::monotonic_deadline_timer> connectTimeoutTimer =
-    make_shared<ndn::monotonic_deadline_timer>(boost::ref(getGlobalIoService()));
+    make_shared<ndn::monotonic_deadline_timer>(ref(getGlobalIoService()));
 
   clientSocket->async_connect(remoteEndpoint,
                               bind(&TcpChannel::handleSuccessfulConnect, this, _1,
@@ -104,14 +104,14 @@
                     const time::seconds& timeout/* = time::seconds(4)*/)
 {
   shared_ptr<ip::tcp::socket> clientSocket =
-    make_shared<ip::tcp::socket>(boost::ref(getGlobalIoService()));
+    make_shared<ip::tcp::socket>(ref(getGlobalIoService()));
 
   shared_ptr<ndn::monotonic_deadline_timer> connectTimeoutTimer =
-    make_shared<ndn::monotonic_deadline_timer>(boost::ref(getGlobalIoService()));
+    make_shared<ndn::monotonic_deadline_timer>(ref(getGlobalIoService()));
 
   ip::tcp::resolver::query query(remoteHost, remotePort);
   shared_ptr<ip::tcp::resolver> resolver =
-    make_shared<ip::tcp::resolver>(boost::ref(getGlobalIoService()));
+    make_shared<ip::tcp::resolver>(ref(getGlobalIoService()));
 
   resolver->async_resolve(query,
                           bind(&TcpChannel::handleEndpointResolution, this, _1, _2,
@@ -140,9 +140,9 @@
 
   shared_ptr<Face> face;
   if (socket->local_endpoint().address().is_loopback())
-    face = make_shared<TcpLocalFace>(boost::cref(socket), isOnDemand);
+    face = make_shared<TcpLocalFace>(socket, isOnDemand);
   else
-    face = make_shared<TcpFace>(boost::cref(socket), isOnDemand);
+    face = make_shared<TcpFace>(socket, isOnDemand);
 
   face->onFail += bind(&TcpChannel::afterFaceFailed, this, remoteEndpoint);
 
@@ -178,7 +178,7 @@
 
   // prepare accepting the next connection
   shared_ptr<ip::tcp::socket> clientSocket =
-    make_shared<ip::tcp::socket>(boost::ref(getGlobalIoService()));
+    make_shared<ip::tcp::socket>(ref(getGlobalIoService()));
   m_acceptor->async_accept(*clientSocket,
                            bind(&TcpChannel::handleSuccessfulAccept, this, _1,
                                 clientSocket,
diff --git a/daemon/face/tcp-factory.cpp b/daemon/face/tcp-factory.cpp
index 07d7a86..bb08313 100644
--- a/daemon/face/tcp-factory.cpp
+++ b/daemon/face/tcp-factory.cpp
@@ -115,7 +115,7 @@
   if(static_cast<bool>(channel))
     return channel;
 
-  channel = make_shared<TcpChannel>(boost::cref(endpoint));
+  channel = make_shared<TcpChannel>(endpoint);
   m_channels[endpoint] = channel;
   prohibitEndpoint(endpoint);
 
diff --git a/daemon/face/udp-channel.cpp b/daemon/face/udp-channel.cpp
index ca052a2..99d01e3 100644
--- a/daemon/face/udp-channel.cpp
+++ b/daemon/face/udp-channel.cpp
@@ -42,7 +42,7 @@
   ///       We need to check this
   ///       (SO_REUSEADDR doesn't behave uniformly in different OS)
 
-  m_socket = make_shared<ip::udp::socket>(boost::ref(getGlobalIoService()));
+  m_socket = make_shared<ip::udp::socket>(ref(getGlobalIoService()));
   m_socket->open(m_localEndpoint.protocol());
   m_socket->set_option(boost::asio::ip::udp::socket::reuse_address(true));
   if (m_localEndpoint.address().is_v6())
@@ -106,7 +106,7 @@
 
   //creating a new socket for the face that will be created soon
   shared_ptr<ip::udp::socket> clientSocket =
-    make_shared<ip::udp::socket>(boost::ref(getGlobalIoService()));
+    make_shared<ip::udp::socket>(ref(getGlobalIoService()));
 
   clientSocket->open(m_localEndpoint.protocol());
   clientSocket->set_option(ip::udp::socket::reuse_address(true));
@@ -134,7 +134,7 @@
 {
   ip::udp::resolver::query query(remoteHost, remotePort);
   shared_ptr<ip::udp::resolver> resolver =
-  make_shared<ip::udp::resolver>(boost::ref(getGlobalIoService()));
+    make_shared<ip::udp::resolver>(ref(getGlobalIoService()));
 
   resolver->async_resolve(query,
                           bind(&UdpChannel::handleEndpointResolution, this, _1, _2,
@@ -180,7 +180,7 @@
 {
   udp::Endpoint remoteEndpoint = socket->remote_endpoint();
 
-  shared_ptr<UdpFace> face = make_shared<UdpFace>(boost::cref(socket), isOnDemand);
+  shared_ptr<UdpFace> face = make_shared<UdpFace>(socket, isOnDemand);
   face->onFail += bind(&UdpChannel::afterFaceFailed, this, remoteEndpoint);
 
   onFaceCreated(face);
@@ -215,7 +215,7 @@
   }
   else {
     shared_ptr<ip::udp::socket> clientSocket =
-      make_shared<ip::udp::socket>(boost::ref(getGlobalIoService()));
+      make_shared<ip::udp::socket>(ref(getGlobalIoService()));
     clientSocket->open(m_localEndpoint.protocol());
     clientSocket->set_option(ip::udp::socket::reuse_address(true));
     clientSocket->bind(m_localEndpoint);
diff --git a/daemon/face/udp-channel.hpp b/daemon/face/udp-channel.hpp
index f97c3a3..73403aa 100644
--- a/daemon/face/udp-channel.hpp
+++ b/daemon/face/udp-channel.hpp
@@ -124,8 +124,7 @@
    *        associated with any UdpFace
    */
   void
-  newPeer(const boost::system::error_code& error,
-                   std::size_t nBytesReceived);
+  newPeer(const boost::system::error_code& error, std::size_t nBytesReceived);
 
   void
   handleEndpointResolution(const boost::system::error_code& error,
diff --git a/daemon/face/udp-factory.cpp b/daemon/face/udp-factory.cpp
index e97e9bb..470fd5e 100644
--- a/daemon/face/udp-factory.cpp
+++ b/daemon/face/udp-factory.cpp
@@ -148,8 +148,7 @@
                 "create a multicast face");
   }
 
-  channel = make_shared<UdpChannel>(boost::cref(endpoint),
-                                    timeout);
+  channel = make_shared<UdpChannel>(endpoint, timeout);
   m_channels[endpoint] = channel;
   prohibitEndpoint(endpoint);
 
@@ -208,7 +207,7 @@
   }
 
   shared_ptr<ip::udp::socket> clientSocket =
-    make_shared<ip::udp::socket>(boost::ref(getGlobalIoService()));
+    make_shared<ip::udp::socket>(ref(getGlobalIoService()));
 
   clientSocket->open(multicastEndpoint.protocol());
 
@@ -249,7 +248,7 @@
 
   clientSocket->set_option(ip::multicast::enable_loopback(false));
 
-  multicastFace = make_shared<MulticastUdpFace>(boost::cref(clientSocket), localEndpoint);
+  multicastFace = make_shared<MulticastUdpFace>(clientSocket, localEndpoint);
   multicastFace->onFail += bind(&UdpFactory::afterFaceFailed, this, localEndpoint);
 
   m_multicastFaces[localEndpoint] = multicastFace;
@@ -326,8 +325,8 @@
       return;
     }
   }
-  onConnectFailed("No channels available to connect to "
-                  + boost::lexical_cast<std::string>(endpoint));
+  onConnectFailed("No channels available to connect to " +
+                  boost::lexical_cast<std::string>(endpoint));
 }
 
 shared_ptr<UdpChannel>
diff --git a/daemon/face/unix-stream-channel.cpp b/daemon/face/unix-stream-channel.cpp
index efdf700..d64f333 100644
--- a/daemon/face/unix-stream-channel.cpp
+++ b/daemon/face/unix-stream-channel.cpp
@@ -96,7 +96,7 @@
       throw Error(m_endpoint.path() + " already exists and is not a socket file");
     }
 
-  m_acceptor = make_shared<stream_protocol::acceptor>(boost::ref(getGlobalIoService()));
+  m_acceptor = make_shared<stream_protocol::acceptor>(ref(getGlobalIoService()));
   m_acceptor->open();
   m_acceptor->bind(m_endpoint);
   m_acceptor->listen(backlog);
@@ -108,7 +108,7 @@
     }
 
   shared_ptr<stream_protocol::socket> clientSocket =
-    make_shared<stream_protocol::socket>(boost::ref(getGlobalIoService()));
+    make_shared<stream_protocol::socket>(ref(getGlobalIoService()));
 
   m_acceptor->async_accept(*clientSocket,
                            bind(&UnixStreamChannel::handleSuccessfulAccept, this,
@@ -134,7 +134,7 @@
   NFD_LOG_DEBUG("[" << m_endpoint << "] << Incoming connection");
 
   shared_ptr<stream_protocol::socket> clientSocket =
-    make_shared<stream_protocol::socket>(boost::ref(getGlobalIoService()));
+    make_shared<stream_protocol::socket>(ref(getGlobalIoService()));
 
   // prepare accepting the next connection
   m_acceptor->async_accept(*clientSocket,
@@ -142,7 +142,7 @@
                                 boost::asio::placeholders::error, clientSocket,
                                 onFaceCreated, onAcceptFailed));
 
-  shared_ptr<UnixStreamFace> face = make_shared<UnixStreamFace>(boost::cref(socket));
+  shared_ptr<UnixStreamFace> face = make_shared<UnixStreamFace>(socket);
   onFaceCreated(face);
 }
 
diff --git a/daemon/face/unix-stream-factory.cpp b/daemon/face/unix-stream-factory.cpp
index 96a158a..45668c9 100644
--- a/daemon/face/unix-stream-factory.cpp
+++ b/daemon/face/unix-stream-factory.cpp
@@ -39,7 +39,7 @@
   if (channel)
     return channel;
 
-  channel = make_shared<UnixStreamChannel>(boost::cref(endpoint));
+  channel = make_shared<UnixStreamChannel>(endpoint);
   m_channels[endpoint] = channel;
   return channel;
 }
diff --git a/daemon/face/websocket-channel.cpp b/daemon/face/websocket-channel.cpp
index db7fdc0..f409dc9 100644
--- a/daemon/face/websocket-channel.cpp
+++ b/daemon/face/websocket-channel.cpp
@@ -78,7 +78,7 @@
       m_server.close(hdl, websocketpp::close::status::normal, "closed by channel", ecode);
     }
   shared_ptr<WebSocketFace> face = make_shared<WebSocketFace>(FaceUri(remote), this->getUri(),
-                                                              hdl, boost::ref(m_server));
+                                                              hdl, ref(m_server));
   m_onFaceCreatedCallback(face);
   m_channelFaces[hdl] = face;
 }
diff --git a/daemon/face/websocket-factory.cpp b/daemon/face/websocket-factory.cpp
index 224a75b..8a6e6c3 100644
--- a/daemon/face/websocket-factory.cpp
+++ b/daemon/face/websocket-factory.cpp
@@ -43,7 +43,7 @@
   if (static_cast<bool>(channel))
     return channel;
 
-  channel = make_shared<WebSocketChannel>(boost::cref(endpoint));
+  channel = make_shared<WebSocketChannel>(endpoint);
   m_channels[endpoint] = channel;
 
   return channel;