Nesting Lists Within Lists


You can embed one list in another. This is called nesting. Any type of list can be nested within any other type of list. The nested list can be of the same or different type as the list in which it is nested. The following example nests unordered lists within an ordered list.

Example <ospace/web/examples/list4.cpp>
#include <iostream.h>
#include <ospace/web.h>

int main()
  {
  os_page page( "List#4 Example" );

  os_ordered_list list;

  os_unordered_list systk( os_bold( "Systems<ToolKit>" ) );
  systk << "Processes"
        << "Threads"
        << "Network Programming";

  os_unordered_list stltk( os_bold( "STL<ToolKit>" ) );
  stltk << "ANSI/ISO Standard"
        << "Collections"
        << "Algorithms"
        << "Adapters";

  os_unordered_list webtk( os_bold( "Web<ToolKit>" ) );
  webtk << "Dynamic HTML Page Generation"
        << "CGI Form Processing";

  list << systk
       << stltk
       << webtk;

  page << os_bold( "Sample Recursion Software Products" )
       << list;
  cout << page;
  return 0;
  }


Copyright©1994-2026 Recursion Software LLC
All Rights Reserved - For use by licensed users only.