Project

General

Profile

Actions

Bug #2660

closed

Exclude::excludeOne: incorrect for default-constructed Name::Component

Added by Junxiao Shi over 9 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Category:
Base
Target version:
Start date:
03/20/2015
Due date:
% Done:

100%

Estimated time:
1.00 h

Description

Snippet to reproduce:

// g++ -std=c++0x x.cpp $(pkg-config --cflags --libs libndn-cxx)
#include <ndn-cxx/name.hpp>
#include <ndn-cxx/exclude.hpp>

using ndn::Name;
using ndn::Exclude;

int
main()
{
  std::cout << (Name::Component() == Name::Component("") ? 1 : 0) << std::endl;
  std::cout << Name::Component() << std::endl;
  std::cout << Name::Component("") << std::endl;
  std::cout << (Exclude().excludeOne(Name::Component()) == Exclude().excludeOne(Name::Component("")) ? 1 : 0) << std::endl;
  std::cout << Exclude().excludeOne(Name::Component()) << std::endl;
  std::cout << Exclude().excludeOne(Name::Component("")) << std::endl;

  return 0;
}

Expected output:

1
...
...
1
...
...

Actual output:

1
...
...
0

...

Despite that Name::Component() equals Name::Component(""), Exclude::excludeOne is treating them differently.

Actions

Also available in: Atom PDF