Thread: boost - mutli index container

  1. #1
    Registered User subdene's Avatar
    Join Date
    Jan 2002
    Posts
    367

    boost - mutli index container

    Hello,

    Would anyone know why this compiles with the following error message:

    multi_index\ordered_index.hpp(941): error C2064: term does not evaluate to a function taking 2 arguments
    Code:
    typedef multi_index_container<
    	shared_ptr<CustomItem>,
    	indexed_by<		
    				ordered_non_unique < 
    					composite_key<
    					CustomItem,
    					member<CustomItem, int, &CustomItem::mOne >,
    					member<CustomItem, int, &CustomItem::mTwo>,
    					member<CustomItem, int, &CustomItem::mThree>
    					>,
    					sequenced<>
    				>
    	>
    > CUSTOM_ITEMS;
    The insert fails - If commented out, it works fine:

    Code:
    CUSTOM_ITEMS mCustomItems;
    shared_ptr<CustomItem> customItem( new CustomItem() );
    mCustomItems.insert(customerItem);
    If I take the additional sequence index off the declaration I can insert my items with no compilation issues.

    I just wanted two indexs, the first one so that they are ordered by composite key, which works fine. The second being sequenced so that the insertion order of the container is preserved.

    Even if I explicitly reference the first index, mCustomItems.get<0>().insert - that still fails.

    Does anyone know why simply adding the additional sequenced index would cause this compilation issue?

    Using:
    VS 2010 SP1
    boost_1_48_0
    WIN 7

    Thanks.
    Be a leader and not a follower.

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    You've got a nesting error - you're passing the sequenced<> as an argument to ordered_non_unique<> instead of indexed_by<>.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 08-12-2011, 03:07 AM
  2. best container to copy to from boost::multi_index
    By StainedBlue in forum C++ Programming
    Replies: 1
    Last Post: 06-05-2010, 11:22 PM
  3. Mutli Switch statement help
    By elwad in forum C Programming
    Replies: 9
    Last Post: 05-09-2009, 03:19 AM
  4. Replies: 2
    Last Post: 05-06-2008, 10:41 AM
  5. Replies: 4
    Last Post: 03-21-2004, 03:34 PM